您需要确保您尝试部署到的服务器已安装HTTPPlatformHandler。
您还需要确保您的 project.json 具有引用的 IISIntegration 包,并且具有包含您的 web.config 的包含。它应该看起来像这样:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
您的 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="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
注意:如果您不是从 Visual Studio 内部发布,环境变量 LAUNCHER_PATH 和 LAUNCHER_ARGS 可能会让您有些头疼。
要在 Azure VM 上启动并运行 RC2 站点,我必须将该行更改为如下所示:
<aspNetCore processPath="dotnet" arguments="./YourAppEntryPoint.dll"
stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>