zoukankan      html  css  js  c++  java
  • .Netcore Windows Authentication

    .Netcore  默认Server 是Kestrel, 这是跨平台的,与Windows 认证无关。

    新建.Netcore  Webapi项目,选择Windows 认证,这样的项目,https 能直接打开的。

    在Controller上加  [Authorize]

    部署到IIS    上,需要配置develop 证书。

    IIS 安装,需要勾选Windows 认证。

    发布 之前,添加web.config:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <location path="." inheritInChildApplications="false">
            <system.webServer>
                <security>
                    <authentication>
                        <anonymousAuthentication enabled="false" />
                        <windowsAuthentication enabled="true" />
                    </authentication>
                </security>
            </system.webServer>
        </location>
    </configuration>

    发布之后  如果500.19  参考这个  https://www.cnblogs.com/jxxy2012nw/p/5629225.html

    %windir%system32inetsrvappcmd unlock config -section:system.webServer/security/authentication/anonymousAuthentication
       Unlocked section "system.webServer/security/authentication/anonymousAuthentication" at configuration path "MACHINE/WEBROOT/APPHOST".
    
     %windir%system32inetsrvappcmd unlock config -section:system.webServer/security/authentication/windowsAuthentication

    发布之后,如果不指定进程内,或进程外,默认是进程外,会 在响应头上有 

    Content-Type: application/json; charset=utf-8
    Date: Tue, 04 Aug 2020 08:51:51 GMT
    Persistent-Auth: true
    Server: Kestrel
    Transfer-Encoding: chunked
    X-Powered-By: ASP.NET
    指定 进程内:
    Server: Microsoft-IIS/10.0
    WWW-Authenticate: Negotiate oRswGaADCgEAoxIEEAEAAABz5p6ZgZgwTQAAAAA=
    X-Powered-By: ASP.NET

    在VS2019 调试的时候,可以选择IIS 调试和 Application 调试。

    在Windows认证的项目中,只能用IIS 调试,这里启动的是IIS Express.  IIS Express需要配置为Windows认证。

    在Web宿主项目中的 .vs/config ,有名为applicationhost.config配置文件,打开它后,修改相关配置

    气功波(18037675651)
  • 相关阅读:
    函数防抖与函数节流 封装好的debounce和throttle函数
    机顶盒
    getchar() putchar()
    【整】char、varchar、nchar、nvarchar的区别
    主机名
    主机
    java中的匿名内部类总结
    智能路由器又多一个玩家——乐视TV
    乐视开始折腾路由器,小米与极路由还会好过吗?
    带你认识什么是路由器
  • 原文地址:https://www.cnblogs.com/qgbo/p/13434170.html
Copyright © 2011-2022 走看看