Windows 8 VS2012 IISExpress Windows Authentication
Asked Answered
P

1

6

I'm trying to enable Windows Authentication to develop locally, as per the title:

  • Windows 8 (pro)
  • VS2012
  • IISExpress
  • ASP.Net MVC4 project
  • Orchard CMS is the project (but I don't think this is relevant)

Via the project properties, I've set Windows Authentication to enabled and Anonymous Authentication to disabled.

In the web.config I've set:

<authentication mode="Windows" />

However, when running the site I'm continually prompted for credentials. Entering Windows 8 or local account credentials don't seem to make any difference and I've set those accounts to have full permissions on the folder.

Any suggestions gratefully received!

UPDATE 1: As suggested by Darin Dimitrov I created a blank MVC project and selected the Intranet template. After setting Anonymous Authorisation to disabled and Windows Authentication enabled this test project worked exactly as expected (prompts for credentials when entered provides access to site). I applied the same authorisation config to my Orchard projects web.config:

<authentication mode="Windows" />
<authorization>
  <deny users="?" />
</authorization>

But still no joy, I'm prompted for credentials as expected but nothing I enter seems to authorise the user. I've Pastie'd the two web.configs below in case anyone else can point out what I'm missing?

Pleura answered 19/2, 2013 at 9:26 Comment(1)
Were you using Firefox? That doesn't integrate with Windows auth, at least not without some type of plugin. If this is the case, you need to switch to a browser like IE or Chrome, or keep typing credentials in Firefox.Bolanger
D
11

Make sure you have enabled Windows Authentication in the properties of the Web Server and disabled Anonymous authentication:

enter image description here

Also make sure you have read the Text file that was generated for you when you created your new MVC application using the Intranet Template:

In order to use the Intranet template, you'll need to enable Windows authentication and disable Anonymous authentication.

IIS 7 & IIS 8

  1. Open IIS Manager and navigate to your website.
  2. In Features View, double-click Authentication.
  3. On the Authentication page, select Windows authentication. If Windows authentication is not an option, you'll need to make sure Windows authentication is installed on the server.

    To enable Windows authentication on Windows:

    a) In Control Panel open "Programs and Features".

    b) Select "Turn Windows features on or off".

    c) Navigate to Internet Information Services > World Wide Web Services > Security and make sure the Windows authentication node is checked.

    To enable Windows authentication on Windows Server:

    a) In Server Manager, select Web Server (IIS) and click Add Role Services

    b) Navigate to Web Server > Security and make sure the Windows authentication node is checked.

  4. In the Actions pane, click Enable to use Windows authentication.

  5. On the Authentication page, select Anonymous authentication.
  6. In the Actions pane, click Disable to disable anonymous authentication.

IIS Express

  1. Click on your project in the Solution Explorer to select the project.
  2. If the Properties pane is not open, open it (F4).
  3. In the Properties pane for your project:
    a) Set "Anonymous Authentication" to "Disabled".
    b) Set "Windows Authentication" to "Enabled".
Drainage answered 19/2, 2013 at 9:32 Comment(5)
Thanks but I've already done those. It seems the Windows Authentication is working however it's the actual authenticating I can't seem to do. I'm continuously prompted for login details and no matter what I enter it doesn't authenticate.Pleura
Interestingly from your suggestion I created a blank asp.net MVC project and selected the Intranet template and it works as expected. My local user account login works without issue. Unfortunately I'm not unable to figure out what's different between this and my main project...Pleura
Well, I hope you realize that for me that's even harder to figure out :-) At least you have your code in front of your eyes.Drainage
Sorry yes, it was more a running commentary of my thought process than a useful comment :P Will update the post with the web.configs and findings so far.Pleura
So the info I put in the question was all correct however something I had done was preventing VS2012 from updating the IISExpress applicationhost.config properly. I deleted the site from the applicationhost.config and re-cloned the project from our repo and it worked first time. Awarding you the answer as your answer had the right instructionsPleura

© 2022 - 2024 — McMap. All rights reserved.