iis - 如何配置 .net 核心 API 以在 IIS 中工作?

标签 iis asp.net-core deployment iis-7 .net-core

我在 Visual Studio 2017 中创建了一个运行良好的 .net 核心 API。当我去部署它时,我收到错误消息 HTTP 错误 500.19,错误代码为 0x8007000d。我在网上找到了多种解决方案,例如确保安装了 Windows 功能、删除 .net CLR 版本、更改应用程序池标识、更改 web.config 和 applicationHost.config,但没有任何效果。有没有办法明确地找出问题所在,或者我是否在无数可能的解决方案中反复试验?你知道任何具体的解决方案吗?

以下是 IIS 设置和我的 Windows 功能的屏幕截图:

enter image description here

这是我的 web.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at     http://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*"
        modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet"
                arguments=".\DishbooksAPI.dll" 
                stdoutLogEnabled="false" 
                stdoutLogFile=".\logs\stdout" 
                forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

这是 IIS 错误:

enter image description here

我尝试过的一些 stackoverflow 页面(这不是一个详尽的列表):

HTTP Error 500.19 when publish .net core project into iis

HTTP Error 500.19 with Error Code 0x8007000d visual studio 2017 while deploying .net core application

ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d

HTTP Error 500.19 - Internal Server Error web config .net core web api

asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19

最佳答案

首先,您需要安装 ASP.NET Core Module 在网络服务器中。
这是download link .

然后安装 SDK or Runtime 在网络服务器中。

疑难解答

如果它仍然不起作用,请打开命令提示符。导航到 Web 应用程序文件夹并键入 dotnet YOUR_APP.dll .你应该看到这样的——

C:\APIs> dotnet YOUR_APP.dll
Hosting environment: Production
Content root path: C:\APIs
Now listening on: http://localhost:5000
Application started: Press Ctrl+C to shut down.

这意味着您的应用程序可以在没有 IIS 的 Web 服务器中运行。然后你需要在 IIS 或其他一些事情中进行故障排除。

关于iis - 如何配置 .net 核心 API 以在 IIS 中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50612351/

相关文章:

php - IIS 上的 Drupal 8 - 安装时出错

c# - ASP.NET Core 中 Startup.cs 中的 Kestrel 关闭函数

image - .Net core 在静态文件夹(www)中添加文件夹并保存图像文件

ruby-on-rails - 在 RubyOnRails 应用程序中实现 25K 并发连接

java - 无法上传到谷歌应用引擎

azure - 将 HTTPS 重定向到 HTTP 的规则重写到 IIS 会导致 null HttpContext.Request.ContentType

windows - 从 IIS 重定向到 Apache 后隐藏端口号

visual-studio-2015 - 如何在 ASP.NET mvc 6 和 Visual Studio 2015 中添加 COM 引用?

python - 基于jupyter笔记本创建项目

IIS无法登录azure云服务