gpt4 book ai didi

asp.net - 在应用程序级别之外注册为allowDefinition ='MachineToApplication'的部分

转载 作者:行者123 更新时间:2023-12-04 04:55:20 25 4
gpt4 key购买 nike

将System.Data.Entity的组装添加到我的Web配置中后,出现以下错误:
使用超出应用程序级别注册为allowDefinition ='MachineToApplication'的节是错误的。此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的。

我已经删除了obj和bin文件夹,我删除了行authentication =“windows”,尝试重新打开,因为有人说它可以正常工作,我已经检查了主文件夹中只有1个web.config( Entity Framework -文件夹用于表格,模型,DAL和BLL)...

还有什么其他原因会导致这种情况发生?我到处搜索,基本上就是我发现的上述原因...。

如果有所不同,这是我的web.config:

    <configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="CStringVKB" connectionString="Data Source=.;Initial Catalog=VKB;Persist Security Info=True;User ID=websiteservice;Password=websiteservice" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" optimizeCompilations="true" targetFramework="4.0" >
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<!--<authentication mode="Windows">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</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>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

我该怎么做才能解决这个问题?

最佳答案

基本上,该错误意味着您的子文件夹之一中包含一个web.config文件,该文件具有不应包含的配置元素。这是您的根/仅Web配置文件吗?如果没有,您也可以张贴那些吗?

同样,这听起来很愚蠢,但是我会再次检查您是否正在IDE中打开网站本身(并且没有错误地打开父文件夹)。不在正确的目录中。

这是有关如何为ASP设置web.config层次结构的很好的解释,可帮助您直观地了解其工作方式:http://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx

关于asp.net - 在应用程序级别之外注册为allowDefinition ='MachineToApplication'的部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16187110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com