ASP.NET Core 2.1 Preview 2 App无法在Azure App Service上运行 [英] ASP.NET Core 2.1 Preview 2 App Not working on Azure App Service
问题描述
自此版本发布以来,我一直在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.
现在,Microsoft发布了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 App Service中为我的应用程序删除了ASP.NET Core Runtime扩展,该扩展程序显示了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 App服务中,但是出现错误.首先,我得到了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:\ Program 文件\ dotnet \ sdk \ 2.1.300-preview2-008530 \ Sdks \ Microsoft.NET.Sdk \ targets \ Microsoft.NET.RuntimeIdentifierInference.targets(125,5): 错误:RuntimeIdentifier平台"win10-x64"和 PlatformTarget'x86'必须兼容.
C:\Program Files\dotnet\sdk\2.1.300-preview2-008530\Sdks\Microsoft.NET.Sdk\targets\Microsoft.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运行时-如下所示:
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
时,仍然收到502.5和Kudu控制台中的相同消息,告诉我找不到正确的运行时版本.
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 Web应用发布到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" Version="2.1.0-rc1-final" />
<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" Version="2.1.0-rc1-final" />
这篇关于ASP.NET Core 2.1 Preview 2 App无法在Azure App Service上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!