ASP.NET MVC6 Beta8& Windows验证 [英] ASP.NET MVC6 Beta8 & Windows Authentication
问题描述
升级到Beta 8后,在IIS Express中无法使用Windows身份验证进行调试.我遇到错误
After upgrading to Beta 8, debugging using the windows authentication doesn't work in IIS Express. I am getting an error
尝试确定托管您的应用程序的DNX进程的进程ID时发生错误."
"An error occurred attempting to determine the process id of the DNX process hosting your application."
重现步骤:
- 创建一个新项目,然后选择清空Web模板".
- 在项目设置中,将IIS Express设置更改为使用Windows身份验证.取消选中匿名身份验证.
- 启用SSL.
- 调试项目.
- 出现错误.
我正在使用Windows和Visual Studio的新安装.除了安装文件之外,我是否需要下载其他软件?
I am using new installation of Windows and Visual Studio. Do I need to download any additional software apart from the installation files?
推荐答案
As noted in the comments, there is an open tooling issue for this bug. In the mean time, I've been able to successfully debug using WebListener which needs the following two changes:
在Startup.cs
using Microsoft.AspNet.Http.Features;
using Microsoft.Net.Http.Server;
,然后在Configure
方法中添加:
var listener = app.ServerFeatures.Get<WebListener>();
if (listener != null)
{
listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM;
}
在project.json
中,添加新的weblistener命令,如下所示:
In project.json
add a new weblistener command as follows:
"commands": {
"weblistener": "Microsoft.AspNet.Server.WebListener --config hosting.ini",
"web": "Microsoft.AspNet.Server.Kestrel"
},
,并确保在dependencies
部分中拥有WebListener
and ensure you have WebListener in your dependencies
section
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
从Beta 7升级时,我不得不将hosting.ini文件更改为json格式-不知道这是否重要!
As I was upgrading from beta 7, I had to change my hosting.ini file into json format - don't know if that's important or not!
完成此操作后,您应该能够使用weblistener而不是IIS Express进行调试.无法使用网络(即kestrel)进行调试,因为kestrel不(也不会)支持NTLM身份验证.
Once this is done, you should be able to debug using weblistener instead of IIS Express. Using web (i.e. kestrel) to debug does not work, as kestrel does not (and will not) support NTLM authentication.
我发现,如果我直接在project.json中更改了"web"命令,Visual Studio会非常有帮助地将其更改为kestrel,因此添加了单独的命令
I found that if I changed the "web" command directly in project.json, Visual Studio helpfully changes it back to kestrel rather aggressively, so adding a separate command as recommended by the Microsoft team seems to keep everything happy.
这篇关于ASP.NET MVC6 Beta8& Windows验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!