[英]Web Api Core hangs when start it on IIS Express in Visual Studio 2017?
I just updated Visual Studio to final version of 2017.我刚刚将 Visual Studio 更新到 2017 年的最终版本。
I'm working on a WebApi core project.我正在开发一个 WebApi 核心项目。
Whenever I start it with IIS Express, Google Chrome comes up and stay on loading in the following page without any responses每当我用 IIS Express 启动它时,谷歌浏览器就会出现并继续在下一页中加载而没有任何响应
What's wrong with it?它出什么问题了?
The problem on github github上的问题
Enabling IISExpress
on WebApi Core:在 WebApi Core 上启用IISExpress
:
1. Enabling the IISIntegration components: 1.启用 IISIntegration 组件:
Install Microsoft.AspNetCore.Server.IISIntegration
package.安装Microsoft.AspNetCore.Server.IISIntegration
包。
2. Edit Program.cs
in root of project: 2.在项目根目录编辑Program.cs
:
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() // Add this line
.UseStartup<Startup>()
.Build();
i had to disable javascript debugging to get it to work.我不得不禁用 javascript 调试才能让它工作。 under options>debugging> uncheck Enable javascript for ASP.NET(Chrome and IE)在选项>调试>取消选中为ASP.NET(Chrome和IE)启用javascript
I know this is old, but I came across this error in VS 2019: netcoreapp3.1我知道这很旧,但我在 VS 2019 中遇到了这个错误:netcoreapp3.1
The correct way to build the web host is adding to the DefaultBuilder构建网络主机的正确方法是添加到 DefaultBuilder
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
But if you want to do this manually you must UseIIS() in addition to UseIISIntegration()但是,如果您想手动执行此操作,除了 UseIISIntegration() 之外,您还必须 UseIIS()
return new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration(YourAppConfigurationMethod)
.UseIIS()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.