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

查看:137
本文介绍了如何配置.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:

< a href = https://i.stack.imgur.com/e11hQ.jpg rel = nofollow noreferrer>

这是我的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=".\logs\stdout" 
                forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

这是IIS错误:

< a href = https://i.stack.imgur.com/iOKp6.jpg rel = nofollow noreferrer>

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

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

HTTP错误500.19将.net核心项目发布到iis

在部署.net核心应用程序时,HTTP错误500.19,错误代码为0x8007000d visual studio 2017

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

HTTP错误500.19-内部服务器错误Web配置.net核心网页API

asp.net核心Web API给出错误500.19

推荐答案

首先,您需要安装 ASP.NET核心模块
这是下载链接

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

然后安装 SDK或运行时

故障排除

如果仍然无法使用,请打开命令提示符。导航到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天全站免登陆