问题描述
自从此版本发布以来,我一直在 Azure 上运行我的 ASP.NET Core 2.1 Preview-1 应用程序.我已经通过门户安装了 ASP.NET Core 运行时扩展,它运行良好.
I've been running my ASP.NET Core 2.1 Preview-1 app on Azure since this release became available. I had installed the ASP.NET Core runtime extensions through the portal and it's been working fine.
现在微软发布了 ASP.NET Core 2.1 Preview-2,我安装了 SDK 的升级.更新了我的 Nuget 包,以便我拥有所有内容的 preview-2 版本.请参阅下面的我的 csproj 文件:
Now that Microsoft released ASP.NET Core 2.1 Preview-2, I installed the upgrade to the SDK. Updated my Nuget packages so that I have the preview-2 versions of everything. See my csproj file below:
我还为我的应用程序从 Azure 应用程序服务中删除了 ASP.NET Core 运行时扩展,该应用程序显示 2.1 Preview-1.而是分别为 x86 和 x64 安装了 ASP.NET Core 2.1 运行时——见下文:
I also removed the ASP.NET Core Runtime extensions from Azure App Service for my app which was showing 2.1 Preview-1. Instead installed ASP.NET Core 2.1 run times for x86 and x64 separately -- see below:
编译了应用程序并将其发布到我的 Azure 应用程序服务,但出现错误.首先我得到了 502.5 错误.现在,我得到:
Compiled the app and published it to my Azure App service but I'm getting errors. First I got the 502.5 error. Now, I'm getting:
指定的 CGI 应用程序遇到错误,服务器终止进程.
The specified CGI application encountered an error and the server terminated the process.
我在这里错过了什么?
更新:
正如答案所建议的,我将目标设置为 x86(为了安全起见)——见下文:
As the answer suggested, I set my target to x86 (to play it safe) -- see below:
我删除了扩展以及单独的 x86 和 x64 运行时,只安装了支持 ASP.NET Core 2.1 preview-2 的 x86——见下文:
I removed the extension and the individual x86 and x64 run times and installed only the x86 with support for ASP.NET Core 2.1 preview-2 -- see below:
我重新启动应用程序几次,我仍然得到 502.5.
I restarted the app several times and I'm still getting 502.5.
然后我尝试通过发出以下命令通过 CLI 命令行进行自我部署:
I then tried to do a self deploy through CLI command line by issuing the following command:
dotnet publish -c Release -r win10-x64
我收到以下错误:
C:程序Filesdotnetsdk2.1.300-preview2-008530SdksMicrosoft.NET.Sdk argetsMicrosoft.NET.RuntimeIdentifierInference.targets(125,5):错误:RuntimeIdentifier 平台win10-x64"和PlatformTarget 'x86' 必须兼容.
C:Program Filesdotnetsdk2.1.300-preview2-008530SdksMicrosoft.NET.Sdk argetsMicrosoft.NET.RuntimeIdentifierInference.targets(125,5): error : The RuntimeIdentifier platform 'win10-x64' and the PlatformTarget 'x86' must be compatible.
这是否意味着我安装了 x86 版本的 SDK,并且我必须以 x86 为目标?
Does this mean I have the x86 version of the SDK installed and I must target x86?
从 ASP.NET Core 2.0 升级到 2.1 时,我没有遇到一半的麻烦!!!!
I didn't have half the trouble that I'm going through now going from ASP.NET Core 2.0 to 2.1!!!!
更新 2:刚刚在 Kudu 控制台中运行 dotnet --info
.如果我没看错,说明我没有正确的运行时间.
UPDATE 2:
Just ran dotnet --info
in Kudu console. If I'm reading this correctly, I don't have the correct runtime.
更新 3:
我认为这个屏幕截图证实了我所说的.
I think this screen shot confirms what I was saying.
更新 4:
我安装了 x86 版本的 ASP.NET Core 2.1 Runtime -- 见下文:
I installed x86 version of ASP.NET Core 2.1 Runtime -- see below:
当我在 Kudu 控制台中运行 dotnet --info
时,我得到以下让我感到困惑的信息.我仍然没有看到我期望看到的版本:
When I run dotnet --info
in Kudu console, I get the following which confuses me. I'm still not seeing the version I was expecting to see:
当我点击 URL 时,当我运行 dotnet MyApp.dll
时,我仍然在 Kudu 控制台中收到 502.5 和相同的消息,告诉我找不到正确的运行时版本.
And when I hit the URL, I'm still getting 502.5 and the same message in Kudu console when I run dotnet MyApp.dll
telling me that the correct version of the runtime is not found.
我如何在其中获得正确的版本?我认为通过门户安装它就可以了.
How will I get the correct version in there? I thought installing it through the portal would do it.
推荐答案
我们已成功使用自包含"部署模式将 ASP.NET Core 2.1 RC1 webapp 发布到 Azure 应用服务.
We've managed to publish ASP.NET Core 2.1 RC1 webapp to Azure app-service using "self-contained" deployment mode.
平台目标:任何 CPU
Platform target: Any CPU
以下是我们的 .csproj 中的包引用:
Here are the package references from our .csproj:
<代码><PackageReference Include="Microsoft.AspNetCore.App"/><PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0-rc1-final" PrivateAssets="All"/><PackageReference Include="Microsoft.AspNetCore.AzureAppServicesIntegration" 版本="2.1.0-rc1-final"/>
这篇关于ASP.NET Core 2.1 Preview 2 App 无法在 Azure 应用服务上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!