无法ASP.NET核心应用部署到IIS - 错误的网关 [英] Unable to deploy ASP.NET Core app to IIS - Bad Gateway
问题描述
一直在努力得到这个工作,我有我想举办一个远程IIS服务器上的一个标准的.NET核心API,这个问题是大多数的教程是ASP.NET 5 / vNext也不要解释一旦你运行你的 DOTNET发布
会发生什么。
我的绑定是正确的,但我不知道如果我在正确的文件夹指向。
Have been struggling to get this to work, I have a standard .NET Core API that I want to host on a remote IIS server, the issue is most of the tutorials are for ASP.NET 5/vNext and don't explain what happens once you run your dotnet publish
.
My bindings are correct but I'm not sure if i'm pointing at the right folder.
在我的输出文件夹,我的发布和 wwwroot文件以及 config.json
和其他一些JSON文件。当我点到IIS在 wwwroot文件文件夹中,我得到:
In my output folder I have publish and wwwroot as well as config.json
and some other json files. When I point IIS to the wwwroot folder I get:
502 - 作为网关或代理服务器的Web服务器接收到一个无效的响应
502 - Web server received an invalid response while acting as a gateway or proxy server.
我得到404如果我尝试将它指向任何其他文件夹。我安装了HttpPlatformHandler 1.2。我的 project.json
如下:
I get 404s if I try point it to any other folder. I have HttpPlatformHandler 1.2 installed. My project.json
is as follows:
{
"compilationOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot"
]
},
"dependencies": {
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
"Microsoft.AspNetCore.Hosting": "1.0.0-*",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-*",
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-*",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
"Microsoft.Extensions.Logging.Debug": "1.0.0-*",
"OpenIddict.Core": "1.0.0-*",
"OpenIddict.EF": "1.0.0-*",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002700"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net451+win8"
]
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-*",
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
}
},
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
},
"content": [
"wwwroot",
"config.json",
"web.config"
],
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
我把这个样本的元素为我 project.json
。
推荐答案
我指着IIS根文件夹的应用程序文件夹和不wwwroot文件和它的工作。
I pointed IIS to the root folder to the application folder and NOT the wwwroot and it worked.
在IIS服务器需要有<一个href=\"https://download.microsoft.com/download/4/6/1/46116DFF-29F9-4FF8-94BF-F9BE05BE263B/DotNetCore.1.0.0.RC2-WindowsHosting.exe\"相对=nofollow> DotNetCore.1.0.0.RC2-WindowsHosting.exe
The IIS server needs to have DotNetCore.1.0.0.RC2-WindowsHosting.exe
这篇关于无法ASP.NET核心应用部署到IIS - 错误的网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!