Virtual directory not being configured as an application in IIS

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.

Source Error:


Line 53:
Line 54:  
Line 55: 
Line 56:   

Solution

Change authentication mode to 'None' in web.config.

Go to your web.config file and change following line

  
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)

Posted: 2 years 9 months ago by xpertprogrammer #164
xpertprogrammer's Avatar
Hi,

Thanks a lot you have given me a good hint to solve my issue.

Bye.