读书人

配置文件有关问题:在应用程序级别之外

发布时间: 2012-04-15 18:39:21 作者: rapoo

配置文件问题:在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的 asp.net
<system.web>
<customErrors mode="Off" defaultRedirect="Views/System/error.aspx">
<error statusCode="400" redirect="Views/System/error.aspx"/>
<error statusCode="403" redirect="Views/System/error.aspx"/>
<error statusCode="404" redirect="Views/System/error.aspx"/>
<error statusCode="405" redirect="Views/System/error.aspx"/>
<error statusCode="500" redirect="Views/System/error.aspx"/>
</customErrors>
<httpRuntime requestValidationMode="2.0" maxRequestLength="10485760"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<machineKey validationKey="3FD666E93BD963D59F746C3E6D786B10F7F7C123" decryptionKey="7868ECAC16B6EE504888965E374030EEE28ED635F929C456" validation="SHA1" decryption="3DES"/>
<authentication mode="Forms">
<!--<forms loginUrl="~/Account/LogOn" timeout="2880" />-->
<forms name=".ASPXAUTH" protection="All" timeout="300" domain="qqn1.dev" path="/" requireSSL="false" slidingExpiration="true" loginUrl="~/Account/LogOn" defaultUrl="/"/>
</authentication>

<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>

<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>

<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
-
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
<httpModules>
<add name="CrossDomainCookie" type="QqNo1.Models.currenty.CrossDomainCookie,QqNo1"/>


</httpModules>
</system.web>
这是代码,麻烦大侠们帮忙看看,哪里有问题

[解决办法]
配置文件问题:在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的 asp.net


web.config放在网站的根目录,如果其他目录有web.config,请保证里面的内容只是你需要的,不要多了,因为web.config的某些节点只能够放在网站的根目录


你的问题经常是由于备份数据,复制了文件夹,造成网站中有多个配置文件,除了网站根目录的,其他的删除就可以了

你搜索有个几web.config就明白
[解决办法]
这个错误是由于没有设置网站的虚拟目录,最有效的解决办法是在IIS中把网站直接配置成站点

方法:在IIS里,点击你源码的虚拟目录,右键-》属性-》应用程序名-》创建即:web.config要在站点的根目录下 如果是在VS中按F5出现这个错误,要修改一下sln文件中站点的路径



建议:直接在IIS下配置站点,而不要VS中调试 注意:要在站点的根目录下建立虚拟目录,如果还是解决不了问题建立站点(或者把站点根目录指向当前程序根目录,即web.config所在目录)

读书人网 >asp.net

热点推荐