IIS中的Asp.Net核心MVC应用程序Windows身份验证
发布时间:2020-12-16 00:01:55 所属栏目:asp.Net 来源:网络整理
导读:我的Asp.Net Core mvc Web应用程序需要Windows身份验证.在开发中,在IIS Express上,由于这个设置,一切正常 launchSettings.json "iisSettings": { "windowsAuthentication": true,"anonymousAuthentication": false,"iisExpress": { "applicationUrl": "http:
我的Asp.Net Core mvc Web应用程序需要Windows身份验证.在开发中,在IIS Express上,由于这个设置,一切正常
launchSettings.json "iisSettings": { "windowsAuthentication": true,"anonymousAuthentication": false,"iisExpress": { "applicationUrl": "http://localhost:61545/","sslPort": 0 } } 部署到IIS时,我得到一个空白页面.对我的网站的请求获得500错误代码. 我尝试将此配置添加到Startup.cs,如here所述,但没有成功. services.Configure<IISOptions>(options => { options.ForwardWindowsAuthentication = true; }); 当我直接在IIS中查看身份验证参数时,将激活Windows身份验证. 我发现一些帖子谈论了一个名为Microsoft.AspNetCore.Server.WebListener的软件包,其他一些关于实现自定义中间件的软件包.我无法想象这个基本功能需要付出那么多努力.我错过了什么吗? 解决方法
launchSettings.json文件仅供VS使用.当您发布应用程序(或在没有VS的情况下运行)时,不会使用launchSettings.json.使用IIS / IISExpress运行时,只需确保web.config具有正确的设置.在您的情况下,web.config中的forwardWindowsAuthToken属性丢失或设置为false.必须将其设置为true才能使Windows身份验证生效.发布前的示例web.config如下所示:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" forwardWindowsAuthToken="true"/> </system.webServer> </configuration> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 从Visual Studio 2015 Update 1 RC恢复
- asp.net-mvc – 在控制器名称和路由中使用破折号的asp mvc?
- asp.net-core – 使用asp.net核心发布视图
- asp.net – 如何在MVC3中使用https生成绝对URL?
- asp.net-mvc-4 – MVC 4 – Web Api和JSON?
- 我到底是什么时候需要在经典的asp中将对象设置为空?
- asp.net-mvc – NullReferenceException ASP.NET MVC文本框
- asp.net – HttpWebRequest正在为404抛出异常
- asp.net – OWIN的这些用法是否可行?
- 如何在回发期间在asp.net mvc中保留部分视图模型数据
推荐文章
站长推荐
热点阅读