Saturday, March 29, 2008

Unable to create the virtual directory. Configuring the virtual directory for ASP.NET 2.0 failed - Problem and Solution

When you try to create a virtual directory for a Web Application Project using Web Property page options of Visual Studio 2005, the following error message is displayed if IIS settings are not proper. The actual error message displayed by Visual Studio 2005 is

Microsoft Visual Studio
Unable to create the virtual directory. Configuring the virtual directory for ASP.NET 2.0 failed. You may need to manually configure this site for ASP.NET 2.0 in order for your site to run correctly.

How to fix the problem?

Invalid ASP.NET version settings is the cause for this error message. When ASP.NET version of IIS is not same as the version of Visual Studio, Visual Studio fails to create virtual directories.

For example, if you are using Visual Studio 2005 with an  IIS configured with ASP.NET v1.1 is an invalid configuration.

In order to solve the problem follow these simple steps

  1. Go to Start Menu, click on Run (alternatively use Win Key + R )
  2. Type INetMgr and press enter to open Internet Information Services Application
  3. Expand the tree node displaying local computer name and navigate to Web Sites-->Default Web Site
  4. Right click on Default Web Site node and select the popup menu option Properties

  1. Navigate to ASP.NET tab in the properties page and set the version to 2.xxxx(for Visual Studio 2005) or 1.xxxx(for Visual Studio 2003)

  1. After configuring ASP.NET settings in IIS, recreate the virtual directory using the Property page of Visual Studio Web Application. Visual Studio successfully creates the virtual folder.



    Anonymous said...

    Many Thanks !

    Manville said...

    Worked great but now I get Server Application Unavalible

    Anonymous said...

    What If I can not see the ASP.NET tab it self for setting.

    FYI: I have visual Studio 2003, 2005, 2008.

    Kamleshkumar Gujarathi.

    Anonymous said...

    Works great!
    Thank you.
    Only that now I get a "You are not authorized to view this page" for my page deployed on the IIS server. But its a different issue.

    Thanks again!

    Namaste :).

    Rushikesh Deshpande said...

    I got the same type of error. I use visual studio 2010.What should be the version ?

    Unknown said...

    Thanks a lot.
    I appreciate your help Gopinath.