我正在用ASPWindows5,MVC6构建一个内部网应用程序。我想知道如何启用.NET身份验证。默认项目模板仅支持单个用户帐户。
发布于 2016-03-17 13:55:33
$(ProjectDir)\Properties\launchSettings.json
文件将触发Visual Studio在针对IISExpress进行适当调试时生成一个web.config
文件,该文件将根据启动设置设置<authentication/>
节点。
下面是一个示例launchSettings.json
{
"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
节点。
发布于 2015-04-08 04:41:05
使用IIS宿主,您可以将包含应用程序的IIS配置的web.config文件添加到wwwroot目录。
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</configuration>
发布于 2015-10-10 05:16:46
我做了我在网上找到的所有东西,没有人工作。因此,我查看了aspnet 4.5配置文件,发现它使用:
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
在.csproj文件上,我只是复制到.xproj文件的aspnet5和它的工作。
https://stackoverflow.com/questions/28542141
复制相似问题