有没有办法在IIS上运行Go Web应用程序?
我找到了azure的设置,但它不能在我的开发机上工作,
这是azure的web配置:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="d:\home\site\wwwroot\go\bin\go.exe"
arguments="run d:\home\site\wwwroot\server.go"
startupTimeLimit="60">
<environmentVariables>
<environmentVariable name="GOROOT" value="d:\home\site\wwwroot\go" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
您的本地IIS无法正常工作,因为您需要安装一个名为HttpPlatformHandler模块的独立组件,
http://www.iis.net/downloads/microsoft/httpplatformhandler
反向代理或FastCGI是这种新方法不再需要的旧方法.
HttpPlatformHandler 模块对我不起作用。我发现Sutean Rutjanalard 在 Medium 上的这篇文章非常有帮助,它使用 ASP.NET Core 模块代替。
基本上,您需要像使用 .net 核心应用程序一样使用“无托管代码”创建应用程序池。以下是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=".\YourGoApp.exe" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)