ASP.NET MVC发布失败 - ASPCONFIG allowDefinition =' MachineToApplication'

时间:2015-06-30 11:01:37

标签: asp.net asp.net-mvc

在添加到web.config

之后,从VS 2013/2012发布MVC项目失败
<authentication ... />

<caching>

etc(注册为allowDefinition =&#39; MachineToApplication&#39;的部分)。

病人:

AspNetCompiler(aspnet_compiler.exe)

错误: ...\myProject\obj\Debug\AspnetCompileMerge\Source\bin\web.config(81,0): Error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. The command exited with code 1. Done building project "myProject.csproj" -- FAILED.

原因:
(Visual Studio 2013,2012)
ASP.NET MVC站点/项目的 bin 文件夹包含与根站点文件夹相同的web.config!
此文件夹由ASP.NET MVC项目/发布持续创建)

site_root\web.config
site_root\bin\web.config

问题

如何处理 AspNetCompiler(aspnet_compiler.exe)以及此 bin \ web.config ?它始终存在。
我想从我的VS))

发布

解决方案Delete Files="$(SolutionDir)\$(ProjectDir)\bin***.*"毫无用处。

1 个答案:

答案 0 :(得分:0)

I had this issue after updating a NuGet package. Look for a folder named "NuGetBackup" inside your site's "App_Data" folder. If you find it, delete it or move it outside of your website files.

The error is caused by having a copy of the root web.config in one of those backups.