3

Publishing of a MVC project from VS 2013/2012 fails just after adding to the web.config

<authentication ... />

or

<caching>

etc (section registered as allowDefinition='MachineToApplication').

Patient:

AspNetCompiler (aspnet_compiler.exe)

Error: ...\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 of the ASP.NET MVC site/project contains the same web.config as the root site folder!
(This folder is created constantly by ASP.NET MVC project/publish)

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

Question

What to do with the AspNetCompiler (aspnet_compiler.exe) and this bin\web.config? It always there.
I want to publish from my VS ))


Solution Delete Files="$(SolutionDir)\$(ProjectDir)\bin***.*" was useless.

Community
  • 1
  • 1
it3xl
  • 2,372
  • 27
  • 37

1 Answers1

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.

HFloyd
  • 328
  • 2
  • 11