首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >asp.net 5中的Windows身份验证

asp.net 5中的Windows身份验证
EN

Stack Overflow用户
提问于 2015-02-16 21:08:44
回答 5查看 13.1K关注 0票数 16

我正在用ASPWindows5,MVC6构建一个内部网应用程序。我想知道如何启用.NET身份验证。默认项目模板仅支持单个用户帐户。

EN

回答 5

Stack Overflow用户

发布于 2016-03-17 13:55:33

$(ProjectDir)\Properties\launchSettings.json文件将触发Visual Studio在针对IISExpress进行适当调试时生成一个web.config文件,该文件将根据启动设置设置<authentication/>节点。

下面是一个示例launchSettings.json

代码语言:javascript
复制
{
  "iisSettings": {
    "windowsAuthentication": true,
    "anonymousAuthentication": false,
    "iisExpress": {
      "applicationUrl": "http://localhost:65070/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    }
  }
}

而且还使用扩展app.UseIISPlatformHandler();,而不是操作侦听器。该扩展将设置一个中间件,该中间件将自动请求NTLM并转换来自IIS的适当句柄。

在部署到IIS时,如果使用的是WebListener,则必须自己将authentication节点添加到web.config中。如果您正在使用HttpPlatformHandler (我个人推荐)并代理到kestrel,请将forwardWindowsAuthToken="true"添加到web.config中的httpPlatform节点。

票数 5
EN

Stack Overflow用户

发布于 2015-04-08 04:41:05

使用IIS宿主,您可以将包含应用程序的IIS配置的web.config文件添加到wwwroot目录。

web.config

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
        <security>
            <authentication>
                <windowsAuthentication enabled="true" />
                <anonymousAuthentication enabled="false" />
            </authentication>
        </security>
  </system.webServer>
</configuration>
票数 4
EN

Stack Overflow用户

发布于 2015-10-10 05:16:46

我做了我在网上找到的所有东西,没有人工作。因此,我查看了aspnet 4.5配置文件,发现它使用:

代码语言:javascript
复制
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

在.csproj文件上,我只是复制到.xproj文件的aspnet5和它的工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28542141

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档