Virtual directory not being configured as an application in IIS

By | April 17, 2011

Problem

Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.

Parser Error Message: 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.

Solution

Change authentication mode to ‘None’ in web.config.

Go to your web.config file and change following line

<authentication mode=”Windows” />

to

<authentication mode=”None” />


This should solve this problem.

Note: If above solution does not work then make sure that the directory from where you website is running is configured as an application in IIS. To do this, you need to go into IIS and find your project folder on the server, right click to Properties. Under Application Settings click Create.

Cause

By default ASP.Net creates Windows authentication mode in Web.Config file. When you run this site locally on your computer, it runs fine. This is because it runs under current windows account credentials (i.e. Your windows login which may have administrative rights). But when you copy it to web server it runs under [MACHINENAME]\ASPNet account. If it does not have appropriate rights, server will throw this error.

Comments/Questions

This actually has to do with Visual Studio and how it deploys it web applications. From my experience you need to go into IIS and find your project folder on the server, right click to Properties. Under Application Settings click Create. It doesnt matter which authentication mode you use with a web project, IIS will not allow it to run as Web Site. It’s configured to be a Web App.
=> Kevin (Thursday 22-May-08 11:56 AM)
 
 
Very helpful comment. Changing authentication mode doesn’t really work.
=> DevAnon (Tuesday 08-Jul-08 07:43 PM)
 
 
 

Leave a Reply

Your email address will not be published.