简体   繁体   English

Web Api Core 在 Visual Studio 2017 中的 IIS Express 上启动时挂起?

[英]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 核心项目。

VS2017-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 启动它时,谷歌浏览器就会出现并继续在下一页中加载而没有任何响应

VS2017-WebApi-Chrome

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();

This has been fixed by download the latest Visual Studio 2017 installer again then install with modify mode.这已通过再次下载最新的 Visual Studio 2017 安装程序然后使用修改模式安装来解决。 They have some update just today.他们今天有一些更新。

Step 1 Step 2步骤 1步骤 2

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.

相关问题 启动IIS Express时发生错误-Visual Studio 2017 - An Error Occured Launching IIS Express - Visual Studio 2017 无法在Visual Studio 2017 RC中启动IIS Express - Unable to launch IIS Express in Visual Studio 2017 RC 是否可以在Visual Studio 2015的其他端口中发布asp.net Web API? IIS不是IIS Express - Is it possible to publish asp.net web api in a different port in Visual Studio 2015 ? IIS not IIS Express 将IIS中的现有网站添加到Visual Studio 2017中的Git - Adding existing Web Site in IIS to Git in Visual Studio 2017 ASP.Net Core Web API 适用于 IIS Express,但在部署到 IIS 时不起作用 - ASP.Net Core Web API works on IIS Express, but not working when deployed to IIS IIS 请求计数限制与 IIS Express - Web ZDB974238714CA8DE634A7CE1D083A - IIS Request Count Limitation vs IIS Express - Web API Core ASP.NET 4.6 WEB API,不提供静态文件(.js,.css)IIS Express Visual Studio - ASP.NET 4.6 WEB API, Not serving static files(.js, .css) IIS express visual studio Visual Studio 2017企业版无法启动ASPNet Core应用程序 - Visual Studio 2017 Enterprise cannot start ASPNet Core application Google Auth在Visual Studio中运行,但在部署到IIS时挂起 - Google Auth runs in Visual studio but hangs when deployed to IIS 当我通过 Visual Studio 中的 IIS Express 在浏览器中打开 web 应用程序时,为什么会给我这个错误? - Why give me this error when I open web app in browser through IIS Express in visual studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM