MSBuild error while compiling ASP.NET website

I get the following error when I try to compile an asp.net site using a custom build script.

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.

Although the description is in detail I do not understand what it means exactly. I have not configured IIS to host this website and I don't think I will be able to as I am running Vista Home Basic version. So the website cannot be built using custom scripts?Please reply as I want to test this feature.

Answers


It is likely that your web.config file is placed in a directory that is not the root of the application. On most versions of IIS, you can convert any folder on your web site to an application root:

  1. Open IIS and navigate to the appropriate folder
  2. Right-click on the folder, select properties
  3. Under Application Settings, and beside Application name, click Create
  4. Apply and close

If this does not fix your problem, there may be another configuration error, either with IIS or your application.


I had this SAME EXACT problem and finally discovered a rogue Web.config was placed in my obj folder ... do yourself a favor and do a search in all the sub-directories for a web.config file. I deleted it and all was back to normal.


The rogue web.config file in the obj folder is most likely to be caused when you do a Publish Web Site. So just clean it up after you've done the publish.


if this happens after the virtual-directory is already created do the following:

  • right-click on web.config
    • properties
      • Build Action: Content
      • Copy to Output directory: Do not copy
  • if transformed (apply to all configurations)
    • properties
      • Build Action: None
      • Copy to Output directory: Do not copy

In IIS, go to the folder that the app runs under, right click it, go to properties. On the Directory tab, look for "Application settings". Click the create button.


Need Your Help

Objective-C pointers?

objective-c oop pointers

I am new to coding and trying to get up to speed with Objective-C.

JayData vs Upshot (crossplatform HTML5 app)

html5 cross-platform hybrid upshot jaydata

I'm just in the planning phase of developing my iPhone/iPad/Android app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.