1

I have an MVC3 intranet application, originally developed in VS 2010. I just tried to open it up on a new machine running VS 2012, but I'm getting this:

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.

It's configured to run under the local IIS web server (using IIS express). There is a WCF service housed in this project using a .svc file, which I can access just fine. I only get this error while accessing the MVC site through the browser. If I switch the project over to use the Visual Studio Development Server, it seems to work fine, but I have to run it under IIS Express, since I need to be able to access the site remotely to test certain functionality.

Is there something I have to do in the web.config or project properties to make this project work in VS 2012?

Here is a snippet from my web.config

<authentication mode="Windows" />
<authorization>
  <deny users="?" />
</authorization>
<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
</profile>
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
  <providers>
    <clear />
    <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
  </providers>
</roleManager>
<customErrors mode="Off" />
<httpModules>
  <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
</httpModules>
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
  • Seems obvious but is MVC installed on the new machine? http://www.asp.net/mvc/mvc3 – Vaze Feb 21 '13 at 17:03
  • @Vaze Yes, MVC3 is installed, as well as 2 and 4. Is there something different I have to do to enable MVC on IIS Express? – p.s.w.g Feb 21 '13 at 18:05
  • As long as the libraries are installed they should work fine with IIS Express. It looks like something isn't working with your Windows Authentication. I'm guessing now but can you try taking out the `` part? And maybe check out these posts: http://stackoverflow.com/questions/5720471/iis-express-http-error-401-2-unauthorized and http://stackoverflow.com/questions/4762538/iis-express-windows-authentication – Vaze Feb 22 '13 at 09:39
  • @Vaze That works, but now the site does not recognize my user name, and does not prompt for my username / password. – p.s.w.g Feb 22 '13 at 23:11
  • OK, looks like we've found the problem. Does this help at all? http://stackoverflow.com/questions/9484121/windows-authentication-does-not-work – Vaze Feb 25 '13 at 14:17
  • @Vaze unfortunately, restarting my machine does not resolve the issue. – p.s.w.g Feb 25 '13 at 15:34

1 Answers1

0

The answer to this question solved my issue:

Windows authentication does not work

I simply edited the applicationhost.config file to allow windows authentication, and the site was up and running under IIS Express:

<windowsAuthentication enabled="true">...</windowsAuthentication>
Community
  • 1
  • 1
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331