Error message 401.2.: Unauthorized: Logon failed due to server configuration. When application deployed

98,749

Solution 1

With IIS, this really just sounds like you need to check the authentication settings for your app in IIS Admin. Try this link: http://support.microsoft.com/kb/253667

This is for IIS6, you didn't mention whether you were using IIS 6 or 7. For IIS 7, try this: http://support.microsoft.com/kb/942043

Solution 2

If you're working with IIS Express, check the web.config

        <!--  AUTHENTICATION 
      This section sets the authentication policies of the application. Possible modes are "Windows", 
      "Forms", "Passport" and "None"
-->
    <authentication mode="Windows"/>
    <identity impersonate="true"/>
    <!--  AUTHORIZATION 
      This section sets the authorization policies of the application. You can allow or deny access
      to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous 
      (unauthenticated) users.
-->
    <!--<authorization>
        <deny users="?"/>-->
        <!-- Allow all users -->
        <!--  <allow     users="[comma separated list of users]"
                         roles="[comma separated list of roles]"/>
              <deny      users="[comma separated list of users]"
                         roles="[comma separated list of roles]"/>
        -->
    <!--</authorization>-->

Solution 3

I upgraded a VS2012 project to 2013 and it changed the Project property from Windows Authentication from Enabled to Disabled and I was then getting this error. Simple change solved the problem. Go to solution and click properties to change this.

If you are using IISExpress, the lines should look something like:

<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

Solution 4

I had the same problem just now. None of the fixes I found worked, so I'll just post here in case it helps someone.

For me the issue was solved this way:

  • Open IIS manager
  • Select "Application Pools"
  • Right click on the application pool you are using and select "Advanced settings"
  • Set "Enable 32-Bit Applications" to "True"
  • Click "OK" to close the dialog box
  • Right click on the application pool again and select "Recycle"

Hope that will help someone else out! This was driving me crazy.

Solution 5

This always happens to our project after it's reloaded. enter image description here

If you're using Windows Authentication, the problem might be as simple as updating your project properties to Enable Windows Authentication.

In Visual Studio, get to your project properties (I usually right-click a file > properties to open the properties window. Then click on my project). Make sure Windows Authentication is set to Enabled

Share:
98,749
user1240615
Author by

user1240615

Updated on July 17, 2022

Comments

  • user1240615
    user1240615 almost 2 years

    I have an asp.net 4.0 application that works fine running under cassini but when i deploy to IIS i get the above error. It is running under the Default App pool which a number of other apps use and work fine. Here is a copy of my web config which may be the source:

    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
      <connectionStrings>
        <add name="FMLconnect" connectionString="Server=192.168.20.125;Port=;Database=FML;Uid=******;Pwd=*****;pooling=false;" providerName="MySql.Data.MySqlClient"  />
      </connectionStrings>
    
      <system.web>
        <httpHandlers>
          <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
          <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
          <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
          <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
          <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
          <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
          <add type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=5.1.11.928, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" path="Telerik.ReportViewer.axd" verb="*" validate="true"/>
        </httpHandlers>
        <compilation debug="true" targetFramework="4.0" >
          <assemblies>
            <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <!--<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>-->
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </assemblies>
        </compilation>
    
    
    
    
      </system.web>
    
      <system.webServer>
           <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>
    </configuration>