如何配置 .net 核心 API 以在 IIS 中工作? [英] How do I configure a .net core API to work in IIS?

查看:23
本文介绍了如何配置 .net 核心 API 以在 IIS 中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've got a .net core API created in Visual Studio 2017 that's working fine. When I go to deploy it I get error message HTTP Error 500.19 with error code 0x8007000d. I've found multiple solutions online such as making sure windows features are installed, removing the .net CLR version, changing the application pool identity, changes to web.config and applicationHost.config, but nothing has worked. Is there a way to definitively find what the problem is or am I stuck doing trial and error with the myriad of possible solutions? Any specific solutions you know of?

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

Here are screenshots of the IIS settings and my Windows features:

这是我的 web.config 文件:

Here's my web.config file:

<?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=".logsstdout" 
                forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

这是 IIS 错误:

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

Some stackoverflow pages I've tried (this is not an exhaustive list):

发布 .net 时出现 HTTP 错误 500.19核心项目进入iis

HTTP 错误 500.19部署 .net 核心应用程序时出现错误代码 0x8007000d Visual Studio 2017

ASP.NET:HTTP 错误 500.19 – 内部服务器错误 0x8007000d

HTTP 错误 500.19- 内部服务器错误 web config .net core web api

asp.net core web api 在移动到不同的 IIS 服务器后在 IIS 中发布的 pc 给出错误 500.19

推荐答案

首先,您需要安装ASP.NET Core 模块 在 Web 服务器中.这是下载链接.

First of all, you need to install ASP.NET Core Module in web server. Here is the download link.

然后安装 SDK 或运行时在网络服务器中.

Then install either SDK or Runtime in web server.

故障排除

如果还是不行,打开命令提示符.导航到 Web 应用程序文件夹并键入 dotnet YOUR_APP.dll.你应该看到这样的东西 -

If it still doesn't work, open a command prompt. Navigate to the web application folder and type dotnet YOUR_APP.dll. You should see something like this -

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 中进行故障排除或其他一些事情.

It means your application can run in the web server without IIS. Then you need to trouble shoot in IIS or some other things.

这篇关于如何配置 .net 核心 API 以在 IIS 中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆