Search code examples
asp.netiis-7windows-server-2008windows-authentication

401.2 Error in ASP.Net 2.0 on IIS 7.0 on Windows 2008


My "Hello World" c#.Net application works fine on my local Windows 7. Moving to our server I get 401.2 error.

Here what I have done (following advices in some forums):

  1. Changed the Anonymous authentication use to application pull user
  2. Created a new application pull
  3. Created a new Windows user with access to application folders
  4. Set the authentication of the application pull to that user
  5. Set the application pull for my application to that application pull

Please note that:

  1. I receive the error both from within the server and outside
  2. I receive this error from all the browser I tested: Chrome, IE 9.0 and Firefox
  3. An html file in the same folder is visible

What am I missing? Thanks, Asaf


Solution

  • You don't need to create a new windows user. I know you've said what steps you've done, but I'm going to highlight what I do each time I add a new site.

    • Set the Identity of the Application Pool to ApplicationPoolIdentity.
    • In the website, set Anonymous Authentication to Enabled. Click Edit on the right and set the Authentication Credentials to Application pool identity.
    • In the website, again, choose Basic Settings on the right. Click the Connect As.. button and make sure Application User is selected.
    • Give the appropriate access to the folder on your hard drive(s); i.e Application Pool name = hello.com, the user is IIS AppPool\hello.com.

    I think your issue is that you haven't given the folder permissions for the Application Pool User. I think you've incorrectly given them to an unneccessary Windows account. HTH