A free and open-source web framework that enables developers to create web apps using C# and HTML, developed by Microsoft.
Hi @Falanga, Rod, DOH ,
Thanks for coming back and sharing your solution.
It’s a great example of how environment differences (Kestrel vs IIS) can lead to subtle issues.
When you run your app using Kestrel (the default HTTPS profile in Visual Studio), you’re using a lightweight, cross-platform web server. However, features like Windows Authentication are not handled the same way unless Kestrel is hosted behind IIS.
On the other hand, when you switch to IIS Express, your app runs in an environment much closer to full IIS, which natively supports Windows Authentication and manages the request pipeline differently.
Microsoft docs explain these differences here:
- https://learn.microsoft.com/aspnet/core/fundamentals/servers/kestrel
- https://learn.microsoft.com/aspnet/core/host-and-deploy/iis/
- https://learn.microsoft.com/aspnet/core/security/authentication/windowsauth
A couple of key takeaways from those:
- Kestrel by itself doesn’t provide the same level of integration for Windows Authentication
- IIS/IIS Express handles authentication and request processing more tightly with Windows
- Running behind IIS ensures the app gets a consistent user identity and request context
So, in your case, when running under Kestrel, parts of your app that depend on Windows Authentication (like cookies or API calls tied to user identity) likely weren’t behaving as expected, which surfaced as those “unhandled exception” errors.
Switching to IIS Express aligned your local environment with how the app is actually hosted, which is why the issue went away.
Hope my explanation was helpful and I would greatly appreciate it if you could follow the instructions here so others with the same problem come across this answer can benefit as well.