ASP.NET Core禁用Windows身份验证 [英] ASP.NET Core disable Windows Authentication
问题描述
我有.NET Core MVC Web应用程序,在创建过程中我设置了Windows身份验证.现在,我想禁用Windows身份验证并启用匿名身份验证(我有自己的身份验证机制).这是我在配置文件中设置的
I have .NET Core MVC web application where during creation I set Windows authentication. Now I want to disable Windows authentication and enable anonymous authentication (I have my own authentication mechanism). Here is what I have set in my config file
.vs \ config \ applicationhost.config
.vs\config\applicationhost.config
<security>
<authentication>
<anonymousAuthentication enabled="true" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
我的问题是,当我重新打开解决方案并运行它时,配置更改为:
My problem is that when I reopen the solution and run it, the config is changing to:
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
有什么可能改变配置,我应该怎么做才能防止这种改变?
How it's possible that something is changing the config and what should I do to prevent this change?
推荐答案
该文件由Visual Studio管理,并且正在重新生成.
The file is managed by Visual Studio and it is being regenerated.
要禁用Windows身份验证,必须将项目设置更改为Visual Studio.此设置存储在 launchSettings.json 文件中,并且当ASP.NET Core托管在IIS Express中时,Visual Studio会为IIS Express进程生成 applicationhost.config .
To disable Windows Authentication, you must change project settings is Visual Studio. This setting is stored in the launchSettings.json file and Visual Studio generates applicationhost.config for the IIS Express process - when ASP.NET Core is hosted in the IIS Express.
Details about this configuration are here: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-2.2
这篇关于ASP.NET Core禁用Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!