App_GlobalResources maps to a directory outside this application, which is not supported.

Problem

I’ve created a very simple ASP.NET 2.0 application. I can run this with no problems using the Built-in Web Server. However, if I publish it and try running the application by typing
http://localhost/talentdata/default.aspx directly in the browser window, I get the following error:
Server Error in ‘/talentdata’ Application.
The path ‘/talentdata/App_GlobalResources’ maps to a directory outside this application, which is not supported.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The path ‘/Beta2_TEST/App_GlobalResources’ maps to a directory outside this application, which is not supported.

Solution

The solution is quite simple. I checked the IIS Default Web Site Properties -> Home Directory -> Local Path. Don’t add any “\” character at the end of the directory, so I changed the Local Path to “C:\Inetpub\wwwroot” instead of “C:\Inetpub\wwwroot\” and restarted IIS.

IIS will automatically add one thus cause problem if you manually add one before. You can check Default Web Site Properties -> ASP.NET -> File Location for actual setting information.