使用exe在IIS上部署ASP.NET Core

mic*_*ver 3 iis asp.net-core

ASP.NET Core 似乎将 Kestrel 服务打包在 .exe 文件中。

我看过的有关在 IIS 中托管 ASP.NET Core 应用程序的所有说明似乎都提到在 DLL 内有一个入口点(Main() 方法)。

如何暂存 .exe 文件以便 IIS 识别它?

我没有看到发布过程的这一部分,我认为这将是一个非常常见的步骤,因为这是 ASP.NET Core 的默认输出。

小智 5

我们通过将以下内容添加到 web.config 文件来做到这一点。请注意 processPath 属性。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath=".\MyDotNetCoreApp.exe" />
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)