locked
Getting an Access Denied error 401.2 when trying to run a new ASP.NET Web Application in VS 2012 RRS feed

  • Question

  • User-900017823 posted

    I’ve got a new ASP.NET web application I’ve made, and copied files over from a ASP.NET web site application into it. I’ve converted the .aspx files into web application (didn’t know that I had to do that until today), and now it all works, with the exception that I’m getting an “Access is denied” error (401.2). I’m using VS 2012, .NET 4.0.30319, ASP.NET version 4.0.30319.18446

     

    This is not running under IIS, it’s using the localhost and auto generated port number that VS 2012 does when you run it from within VS 2012.

    Monday, June 30, 2014 11:27 AM

Answers

  • User-718146471 posted

    From: http://aspdotnerd.blogspot.com/2012/11/error-message-4012-unauthorized-logon.html

    Visual Studio 2012 Error message 401.2.: Unauthorized: Logon failed due to server configuration

    Hi,
    Have started to learn how to build ASP.NET MVC applications using Visual Studio 2012, and have decided to share my experiences hoping that they will benefit those who are making a similar journey.
    One of the first errors that I picked up in running the MVC tutorial at: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4
    was:

    Server Error in '/' Application.


    Access is denied.

    Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
    Error message 401.2.: Unauthorized: Logon failed due to server configuration.  Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server.  Contact the Web server's administrator for additional assistance.


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 

    Resolved by: 1.  Pressing F4 which brings up the Properties pane in the bottom right hand corner

    2, Choosing the application in the Solution Explorer pane. This will then display all the properties relevant to the project in the Properties pane

    3. Change the "Windows Authentication" property to Enabled.

    Solution courtesy: http://saravananarumugam.wordpress.com/2012/03/22/error-message-401-2-unauthorized-logon-failed-due-to-server-configuration/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 30, 2014 11:40 AM

All replies

  • User-718146471 posted

    From: http://aspdotnerd.blogspot.com/2012/11/error-message-4012-unauthorized-logon.html

    Visual Studio 2012 Error message 401.2.: Unauthorized: Logon failed due to server configuration

    Hi,
    Have started to learn how to build ASP.NET MVC applications using Visual Studio 2012, and have decided to share my experiences hoping that they will benefit those who are making a similar journey.
    One of the first errors that I picked up in running the MVC tutorial at: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4
    was:

    Server Error in '/' Application.


    Access is denied.

    Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
    Error message 401.2.: Unauthorized: Logon failed due to server configuration.  Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server.  Contact the Web server's administrator for additional assistance.


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 

    Resolved by: 1.  Pressing F4 which brings up the Properties pane in the bottom right hand corner

    2, Choosing the application in the Solution Explorer pane. This will then display all the properties relevant to the project in the Properties pane

    3. Change the "Windows Authentication" property to Enabled.

    Solution courtesy: http://saravananarumugam.wordpress.com/2012/03/22/error-message-401-2-unauthorized-logon-failed-due-to-server-configuration/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 30, 2014 11:40 AM
  • User-900017823 posted

    I want to make it clear that at this point I'm using the Visual Studio development web server. Not IIS on my machine. It is the developement web server that's causing the error. When I run it the URL looks like this:

    http://localhost:54792/

    and it is that which is giving me the Access is denied error 401.2.

    Monday, June 30, 2014 11:41 AM
  • User-718146471 posted

    The solution above is for the casini built-in or IIS, you need to enable windows authentication.

    Monday, June 30, 2014 11:42 AM
  • User1728944201 posted

    Search your computer for \IISExpress\config\applicationhost.config

    in that file make changes to allow windows authentication:

     <security>
                   
    <authentication>
                       
    <anonymousAuthentication enabled="true" />
                       
    <windowsAuthentication enabled="true" />
                   
    </authentication>

    Monday, June 30, 2014 11:43 AM