Deploying ASP.net Core 2.0 to Azure

一世执手 提交于 2019-12-10 01:25:28

问题


I have upgraded an ASP.net Core 1.1 app to ASP.net Core 2.0 with the following steps:

  • Changed the Target Framework to 2.0
  • Upgraded all Nugget Packages

Now my auto deployment from git runs and says it is successful but the app does not run. I get the following error:

HTTP Error 502.5 - Process Failure

I also added a separate web app deployment slot and tried deploying it there and still get the same result. I have also tried deploying it manually to the slow and no change.


回答1:


The accepted answer did not fix the problem for me.

Steps Required:

Launch Azure Console within the app and delete the contents of the wwwroot folder then redeploy.

RMDIR wwwroot /S /Q

Also, if you have installed the Application Insights Extension within your app. When the app starts you will receive an exception stating that it can't be found.

To fix this error reinstall the Application Insights Extension from the Extensions blade and restart the app.

The problem with the wwwroot folder is that the old Core 1.1 files are not overwritten. Removing the contents of the directory resolves the problem.




回答2:


I had the same problem, which was caused by files leftover from a previous .NET Core 1.1 deployment. The easiest way to fix this is to check the "Remove additional files at destination" under the File Publish Options in your Publish Settings when publishing to Azure from VS.




回答3:


I had to add the following to all the .csproj files in the solution

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>



回答4:


This problem also happens when using DevOps Pipeline for the code targeted to dotnet core 2.1. This is because as of today 10/2, Azure is using DotNetCore 3.0 as default runtime (at least that's what it looks to be). To resolve this problem in devops pipeline, you must install the SDK

Yaml Code:

 steps:
 - task: UseDotNet@2
  displayName: 'Install Core 2.1'
inputs:
  version: 2.2.104

PS: This tells me that you've to install SDK on destination machine too, for dotnet to compile in correct version. (Azure or Windows Server whichever is your destination)



来源:https://stackoverflow.com/questions/45697959/deploying-asp-net-core-2-0-to-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!