Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have .net core(.NET 6) api and React application at client side.

when ever i am enabling the windows authentication in web api and hosted on IIS always getting 401 unauthorized and CORS error .

launchsetting.json

"iisSettings": {
   <big>"windowsAuthentication": true,
   "anonymousAuthentication": false,</big>
   "iis": {
     "applicationUrl": "http://localhost:9100",
     "sslPort": 9001
   },
   "iisExpress": {
     "applicationUrl": "http://localhost:54241",
     "sslPort": 44381
   }
 },


in startup.cs
<big>builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme).AddNegotiate();</big>



and in iis
click on authentication menu and configure

<pre>Anonymous Authentication Enable
Windows Authentication Enable


What I have tried:

I tried to configure as following link
Configure Windows Authentication in ASP.NET Core | Microsoft Docs[^]


but not able to resolve the issue. may be due not able to configure web.config file asper article.


but when i am enabling the
Anonymous Authentication Enable
Windows Authentication Enable

both Anonymous and windows the it is working fine .
but not sure about pros and cons .
Posted
Updated 16-May-22 5:03am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900