ASP.NET MVC Post Failure - ASPCONFIG allowDefinition = 'MachineToApplication'
Publishing MVC project from VS 2013/2012 fails immediately after adding to web.config
<authentication ... />
or
<caching>
etc. (the section is registered as allowDefinition = 'MachineToApplication').
A patient:
AspNetCompiler (aspnet_compiler.exe)
Mistake:
...\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.
Reason:
(Visual Studio 2013, 2012)
The bin folder on the ASP.NET MVC site / project contains the same web.config as the site root folder!
( This folder is created constantly by ASP.NET MVC project / publishing )
site_root\web.config
site_root\bin\web.config
Question
What to do with AspNetCompiler (aspnet_compiler.exe) and this bin \ web.config ? It's always there. I want to post from my VS))
The solution Delete files = "$ (SolutionDir) \ $ (ProjectDir) \ bin ***. *" Was useless.
I got a problem after updating a NuGet package. Find a folder named "NuGetBackup" in your site's "App_Data" folder. If you find it, delete or move it outside of your website files.
The error is caused by a copy of the root web.config in one of these backups.