部分注册为 allowDefinition='MachineToApplication' 外部应用水平

添加液压后 System.Data.Entity 我在Web配置上收到此错误:
使用注册的部分 allowDefinition='MachineToApplication' 在应用程序级别之外,是一个错误。 此错误可能是由虚拟目录未配置为应用程序的事实引起的 IIS.

我删除了文件夹 obj 和 bin, 我删除了这个字符串 authentication="windows", 我试图再次打开一些人的工作,我检查了只在主文件夹中 1 web.config /Entity Framework - 表格文件夹,模型, DAL 和 BLL/...

这会发生什么其他原因? 我在寻找到处,这主要是我发现的上述原因....

这是我的 web.config, 如果它很重要:


<configuration>
<connectionstrings>
<add connectionstring="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" name="ApplicationServices" providername="System.Data.SqlClient"></add>
<add connectionstring="Data Source=.;Initial Catalog=VKB;Persist Security Info=True;User ID=websiteservice;Password=websiteservice" name="CStringVKB" providername="System.Data.SqlClient"></add>
</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"></add>
</assemblies>
</compilation>
<!--<authentication mode="Windows">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>-->
<membership>
<providers>
<clear></clear>
<add applicationname="/" connectionstringname="ApplicationServices" enablepasswordreset="true" enablepasswordretrieval="false" maxinvalidpasswordattempts="5" minrequirednonalphanumericcharacters="0" minrequiredpasswordlength="6" name="AspNetSqlMembershipProvider" passwordattemptwindow="10" requiresquestionandanswer="false" requiresuniqueemail="false" type="System.Web.Security.SqlMembershipProvider"></add>
</providers>
</membership>
<profile>
<providers>
<clear></clear>
<add applicationname="/" connectionstringname="ApplicationServices" name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider"></add>
</providers>
</profile>
<rolemanager enabled="false">
<providers>
<clear></clear>
<add applicationname="/" connectionstringname="ApplicationServices" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"></add>
<add applicationname="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider"></add>
</providers>
</rolemanager>
</system.web>
<system.webserver>
<modules runallmanagedmodulesforallrequests="true"></modules>
</system.webserver>
</configuration>


我该怎么办才能解决这个问题?
已邀请:

小姐请别说爱

赞同来自:

大多数错误意味着在您的一个子文件夹中有一个文件 web.config, 它具有它不应该是的配置元素。 这是你的根 / 单个Web配置文件? 如果没有,你还能发布它们吗?

另外,它听起来很愚蠢,但我两次检查你在我的网站上打开网站 IDE /而不是错误地打开父文件夹/ 我看到人们花了几个小时试图调试同样的错误,当他们在右翼目录中都在右侧。

这是对层次结构的良好解释 web.config 配置为 ASP, 这将帮助您可视化它的工作原理:
http://scottonwriting.net/sowb ... .aspx

卫东

赞同来自:

显然,我的决定中有两个文件 web.config. 我用 MVC4, 并在部分 Views 还有另一个配置文件,我对错误的文件进行了更改。 修复帮助了我。

但是你总是可以改变重定向/文件中的默认路由 global.asax.

君笑尘

赞同来自:

回复克里斯 Noreikis 原则上,这是正确的。 但是一个重要的项目被忽视了。 如果由于任何原因,您将打开项目/在另一个版本中的解决方案 VS, 它最初创造了什么 VS 试图迁移。 有时在这个迁移期间 VS 创建名为的文件夹 "backup" 或者 "backup_{#}". 即使你取消

等待变化

, 这些目录将留下来。

在某些情况下,这些目录的存在 /例如,在我的/ 这是这个错误的原因。 删除这些目录将消除问题。

我希望这将使某人免于我在这个问题上丢失的无数小时。

要回复问题请先登录注册