简体   繁体   中英

HTTP Error 500.32 - ANCM Failed to Load dll after deploying a Self Contained .Net Core 3.1 App to Azure

I have an Asp .NET Core 3.1 App which is deployed to Azure App Service (West Europe/Windows based). When I use a Framework dependendant Deployment Mode, the app is starting smoothly.

But, when I try to switch to a Self Contained deployment, the App fails to start and I get an error message : HTTP Error 500.30 - ANCM In-Process Start Failure

Changing the Runtime from win-x86 to x64 didn't solve the problem.

I inspected the App Server runtime versions installed and it looks like runtimes are available (cf. screenshot below).

What am I doing wrong?

服务器安装的运行时

In case the above does not resolve your issue, and in case you missed it within https://github.com/dotnet/aspnetcore/issues/8980 , but this solved my issue.

Per DimaSUN commented on Jun 25, 2019:

ASP.NET Core 2.2 or later: For a 64-bit (x64) self-contained deployment that uses the in-process hosting model, disable the app pool for 32-bit (x86) processes.

How to: Open Application Pool within IIS. Select the website > Advanced Settings. Set 32-bit Applications from True to False.

For .net 5 the issue is the same I had to remove the hostingModel="inprocess" from the web.config so it read the following

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <location path="." inheritInChildApplications="false">
  <system.webServer>
   <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
   </handlers>
   <aspNetCore processPath=".\Hub.WebApi.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"  />
 </system.webServer>
</location>
</configuration>

Have you tried adding .Net Core 3.1 extension in your app service? Development Tools -> Extensions -> Add -> Asp.Net Core 3.1 with the runtime you require.

I had the same issue yesterday and after adding the extension, the problem was gone.

In the event it helps anyone else... I still had UseKestrel() in my Program.cs (which makes sense given that others mentioned the hosting model as the culprit ).

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder => {
            webBuilder.UseKestrel(k => k.AddServerHeader = false);
            webBuilder.UseStartup<Startup>();
        });

Removing Kestrel (naturally) alleviates the problem.

I also eventually saw this in the Kudu Debug Console ...

Application is running inside IIS process but is not configured to use IIS server

Completely unrelated to the troubleshooting tips this error provides, this can also be caused by insufficient permissions of the app pool account on the source directory of the .NET Core application.

When the service account only had Read permissions I got this error. After adding Read & Execute permissions (since the application is an .exe ) the error went away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM