[英]How to host the basic ASP.NET Core 2 WebAPI application on IIS
I created an application as in subject, just selecting "ASP.NET Core Web Application", ".NET Core", "ASP.NET Core 2.0", "Web API". 我在主题中创建了一个应用程序,只选择“ASP.NET Core Web Application”,“.NET Core”,“ASP.NET Core 2.0”,“Web API”。
This creates a simple application, where the 'default' call, "api/values", returns the JSON array '["value1", "value2"] (with only a minor warning on the browser). 这创建了一个简单的应用程序,其中'default'调用“api / values”返回JSON数组'[“value1”,“value2”](在浏览器上只有一个小警告)。
So far so good. 到现在为止还挺好。
Now I would like to deploy this application on an IIS, just using the FolderProfile, so I build the application, I publish it, and I have this directory with all the files needed to run it. 现在我想在IIS上部署这个应用程序,只使用FolderProfile,所以我构建应用程序,我发布它,我有这个目录,包含运行它所需的所有文件。 I see that a web.config is added (it is not in the sources), with the correct configuration to start the runtime with the generated dll.
我看到添加了web.config(它不在源代码中),具有正确的配置以使用生成的dll启动运行时。
I copy this directory on a physical directory, I create a web site within an application pool, in short, everything, and I configure it as common sense suggests, since I couldn't find any tutorial for ASP.NET Core 2. The docs for Core 1 don't apply correctly, since there are many changes... 我将这个目录复制到一个物理目录上,我在一个应用程序池中创建了一个网站,简而言之,就是一切,我按照常识建议配置它,因为我找不到任何ASP.NET Core 2的教程。对于Core 1没有正确应用,因为有很多变化......
In the end I always end up with this result: 最后,我总是得到这个结果:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
The generated web.config is as follows: 生成的web.config如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Core2WebService.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 5c8e6f19-9a61-47c5-8ee1-8c4b54962ba2-->
I tried whatever I could, but always with this end result... Any ideas? 我尽我所能,但始终以最终结果......任何想法? Thanks.
谢谢。
Check Host on Windows with IIS documentation. 使用IIS文档在Windows上检查主机 。 Right now it looks like you at least forgot to Install the .NET Core Windows Server Hosting bundle .
现在,您似乎至少忘记安装.NET Core Windows Server Hosting软件包 。
The bundle will install the ASP.NET Core Module in addition that creates the reverse-proxy between IIS and the Kestrel server. 该软件包还将安装ASP.NET核心模块,在IIS和Kestrel服务器之间创建反向代理。
You can directly publish from your .Net Core application. 您可以直接从.Net Core应用程序发布。
I have written a step by step guide for the same, only difference is, I have explained to host the application instead of Web API. 我已经为此编写了一步一步的指南,唯一的区别是,我已经解释过托管应用程序而不是Web API。
Have a look here: https://neelbhatt.com/2018/01/30/deploy-net-core-application-to-iis-step-by-step-guide/ 看看这里: https : //neelbhatt.com/2018/01/30/deploy-net-core-application-to-iis-step-by-step-guide/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.