13
votes

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.

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: enter image description here

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: enter image description here

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:

The specified CGI application encountered an error and the server terminated the process.

What am I missing here?

UPDATE:

As the answer suggested, I set my target to x86 (to play it safe) -- see below:

enter image description here

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: enter image description here

I restarted the app several times and I'm still getting 502.5.

I then tried to do a self deploy through CLI command line by issuing the following command:

dotnet publish -c Release -r win10-x64

And I get the following error:

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.

Does this mean I have the x86 version of the SDK installed and I must target x86?

I didn't have half the trouble that I'm going through now going from ASP.NET Core 2.0 to 2.1!!!!

UPDATE 2: Just ran dotnet --info in Kudu console. If I'm reading this correctly, I don't have the correct runtime.

enter image description here

Update 3:

I think this screen shot confirms what I was saying. enter image description here

Update 4:

I installed x86 version of ASP.NET Core 2.1 Runtime -- see below: enter image description here

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:

enter image description here

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.

7
Any interesting error messages using this technique?David Ebbo
No interesting message. I followed the instructions and it created a log file which is empty. I hit the URL of my app again and it created a second log file. Inside the log file, all I see is this: Hosting environment: Production Content root path: D:\home\site\wwwroot Now listening on: 127.0.0.1:32458 Application started. Press Ctrl+C to shut down.Sam
The error I get is either the 502.5 or the one in the original post. It seems to go back and forth between these two errors. Also, interestingly enough, it takes forever before I get an error. It takes a good 45-60 seconds before I get the error.Sam
I'm on the same boat as Sam, exact same symptons. 502.5 or CGI error. Running from inside Kudu's console works correctly.Matias Quaranta
When you install .NET via a site extension, the site extension modifies the PATH of your site putting itself at the beginning. Each site extension is self-contained. If you install both then only one will "win", and it will not know anything about the other extension.Glenn

7 Answers

3
votes

We've managed to publish ASP.NET Core 2.1 RC1 webapp to Azure app-service using "self-contained" deployment mode.

Platform target: Any CPU

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" />

3
votes

The steps I took to get this working:

  • Remove the 2.1-preview1 ASP.NET Core Runtime Extension.
  • Check the application settings to see if you're running under 32-bit or 64-bit.
  • Install only the matching (32- or 64-bit) ASP.NET Core 2.1 Runtime.
  • Restart the web app.

Restarting is important - before restarting the .NET Core tools were the wrong version and I would also get 502.5 errors.

As you've installed both 32- and 64-bit runtimes I'd try removing the one that your application doesn't need and restart the web app.

1
votes

I had the same problem. Finally after 2 hours I fixed it.

Here is my configuration:

Extensions:

enter image description here

Console dotnet --info command:

enter image description here

Console kudu dotnet --version command:

enter image description here

a) Remember to restart your app after install extension.

b) Clear your wwwroot folder from old files and publish again.

1
votes

I got my project working on asp.net core 2.1 Preview 2 on Azure. I did the following steps;

  1. Deleted the old asp.net core extension from Azure app service Extension
  2. Using kudus deleted all the files in wwwroot folder of the site.
  3. Installed asp.net core site extension from Azure as shown in the picture below and restarted the app service

    Azure Web App Site Extension

  4. Before deploying to Azure, the publish configuration option used is as depicted in the picture below, Azure App Service Publish Configuration in VS 2017 15.7 Preview 3

That's it.

0
votes

Try adding a global.json file in your project folder with this content:

{
  "sdk": {
    "version": "2.1.300-preview2-008530"
  }
}

Restart your app after that to be on the safe side.

0
votes

Here's the only thing that seems to have worked for me.

I did a self-contained deployment using

dotnet publish --self-contained -r win10-x64 -c Release

I then had to do a manual deployment -- in my case using FTP.

I really would like this issue to be resolved but if it's not resolved by my next deployment, I'll do the zip deploy. Because my app has a ReactJs frontend, there were thousands of files to deploy and FTP was not a lot of fun!

Because this approach doesn't depend on what's installed or not installed on Azure App Service, it's a much more straight forward solution.

I still want to be able to simply click Publish in Visual Studio though!

UPDATE: I just did a zip deployment and I'm still getting the errors I was getting before even though zip deployment was successful. So, something is still not right! enter image description here

0
votes

I had a problem with a complex website, so I created a simple one with just the App file set at the same version:

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App"  Version="2.1.3" />
  </ItemGroup>

and then, taken from Tim Diekmann's example, I did nothing apart from changing the Deployment Mode in the Azure publishing configuration Settings to Self-Contained - and that worked.