20

I've searched for a while now but I can't seem to find the answer. There are ways of disabling/enabling anonymous and windows authentication. Does anyone know how to enable basic authentication on IIS Express (8.0) in Visual Studio 2013?

Dawid O
  • 6,091
  • 7
  • 28
  • 36

4 Answers4

25

Update ApplicationHost.config

In the the ApplicationHost.config file, find the following nodes and update the values:

<sectionGroup name="authentication"&gt
   <basicAuthentication enabled="false" /> <!-- set to false -->
</sectionGroup&gt

<!-- ... -->

<authentication&gt
   <section name="basicAuthentication" overrideModeDefault="Allow" /> <!-- set to allow -->
</authentication&gt

Locate ApplicationHost.config

  • VS 2015 and above (per Joost's answer):

    sln_folder/.vs/applicationhost.config
    
  • VS 2013 and below:

    %UserProfile%\Documents\IISExpress\config\applicationhost.config
    

    As far as I know, there is no way to enable it for only one project.

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Dawid O
  • 6,091
  • 7
  • 28
  • 36
  • 4
    What if I only want to enable it for one particular project? This sounds like it will be enabled for all sites running on the IIS express – Jepzen Jan 12 '15 at 08:29
  • 1
    slight correction: overrideModeDefault="true" should be overrideModeDefault="Allow" --- but this information will get you there, paired with 2015 .vs directory info from Joost Aarts said. -- Confirmed with VS 2015 – TravisWhidden Dec 22 '16 at 16:59
  • VS 2019 - 2022.01.12. This only worked for me, If I changed my project's own config file under Project/.vs/Project/config/applicationhost.config, and set the to TRUE. Strange. – dezox Jan 12 '22 at 06:45
24

An additional heads up, in Visual Studio 2015, the location of the applicationhost.config file that is actually being used is inside a folder called .vs inside your solution folder. The one in your user profile is not being used

Joost Aarts
  • 673
  • 9
  • 19
2

Here are slightly more details than the previous answer had:

  1. %USERPROFILE%\Documents\IISExpress\config\applicationhost.config: <basicAuthentication enabled="true" />

  2. In the same file: set <anonymousAuthentication enabled="false" userName="" />

  3. If you are not using domain test accounts, create a local user account with the password for the test login.

Dima Korobskiy
  • 1,479
  • 16
  • 26
0

For VS 2022 users under Windows 11 home:

  1. Look for 'applicationhost.config' file...

  2. Located at '...source\repos\ -your app name- .vs\config\applicationhost.config'......

  3. Set 'enable' to 'true' value as showed in the image below:

enter image description here

  1. In my case no extra steps needed.

note: '.vs' is a hidden item. You have to unhidden it.

Sergio Rezende
  • 762
  • 8
  • 25