Asp.net
超出應用程序級別註冊為 allowDefinition=‘MachineToApplication’ 的部分
將 System.Data.Entity 的組件添加到我的 Web 配置後,出現此錯誤:在應用程序級別之外使用註冊為 allowDefinition=‘MachineToApplication’ 的部分是錯誤的。此錯誤可能是由未在 IIS 中配置為應用程序的虛擬目錄引起的。
我刪除了 obj 和 bin 文件夾,我刪除了行 authentication=“windows”,嘗試重新打開,因為有些人說它有效,我檢查了主文件夾中只有 1 個 web.config(實體框架 - 文件夾表格、型號、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 文件,該文件具有不應具有的配置元素。這是您的根/僅網路配置文件嗎?如果沒有,你能把這些也發一下嗎?
此外,這聽起來很愚蠢,但我會仔細檢查您是否在 IDE 中打開網站本身(而不是錯誤地打開父文件夾)我看到人們花了幾個小時試圖調試同樣的錯誤,而他們一直不在正確的目錄中。
以下是關於如何為 ASP 設置 web.config 層次結構的一個很好的解釋,它將幫助您視覺化其工作原理: http ://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx