Intro
So, today I would like to share short bugfix I’ve recently dealt with. I deployed asp.net core application into IIS on my dev machine, because I wanted to do some tests localy, but when I opened my website in browser all I’ve got was this message:
Obiously I’m using Windows auth in my website, but something was not right. Thankfully I’ve seen this in a past so I knew this is most likely caused by disabled Windows Auth in IIS.
Solution
First we need to open IIS Manger, select our website and doubleclick Authentication
item.
Next, we need to right click on Windows Authentication
and select Enable
. But wait, what if there is no Windows Authentication
item?! Just Anonymous Authentication
.
Ok, weird, but fortunately we have google right? Solution to missing Windows Authentication
in IIS Manager is fairly simple. Let’s open Windows Programs and Features
, fastest way is to press +R, type in: appwiz.cpl
and hit Enter. From there click Turn Windows features on or off
, another window will pop up. Now we go trough items: Internet Information Service
World Wide Web Services
Security
and we need to check Windows Authentication
.
Allright, click OK
. Then open IIS Manager again, go to Authentication
section and Windows Authentication
should appear. If there is again only Anonymous Authentication
for some reason, try to restart IIS Manager
as administrator.
After all these steps, website should load correctly, ofcourse if there are no bugs 🙂
Solution for IIS Express
If you encounter same error while running the Asp.Net Core app from Visual Studio/Rider, do following:
- Open
Properties/launchSettings.json
- Look for
windowsAuthentication
property and set it tofalse
1 2 3 4 5 6 |
{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, ... }, |