Reputation: 41
Hoping someone can help out with this issue:
I've deployed my .NET Core 3.0 application on Azure, and even though the it it shows "Publish Succeeded." the application isn't loading (http 500, server error). The "Diagnose and solve problems" tab in Azure point to the module "AspNetCoreModuleV2" as shown in picture Azure - Diagnose and solve problems
I've tried:
Installing the .NET 3.0 Runtime Hosting Bundle as suggested here aspNetCore 2.2.0 - AspNetCoreModuleV2 error
Changing the modules="AspNetCoreModuleV2"
to modules="AspNetCoreModule"
on the web.config file, but the file reverts back to its original values once I publish the app.
Adding <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
to the csproj
but it didn't make a difference so I've deleted that
Here is my current csproj
file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
</ItemGroup>
</Project>
In this is what my web.config
file looks like
<?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="dotnet" arguments=".\SportsStore.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 3f1b616a-5c07-4b23-9c86-ec6506dc3fa7-->
By the way, the application runs without any issues in the local machine
Any help that can point me in the right direction is highly appreciated.
Upvotes: 2
Views: 14591
Reputation: 219
What worked for me, after spending many hours, I'm using VS 2022. I hope it helps someone else.
In web.config, I changed "inprocess" to "OutOfProcess"
<aspNetCore processPath="dotnet" arguments=".\myappdemo.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
Upvotes: 0
Reputation: 408
Edit your csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<AspNetCoreModuleName>AspNetCoreModuleV2</AspNetCoreModuleName>
..
in this way during dotnet publish
the TransformWebConfig
task transforms your web.config
as following, which works also in Azure WebApp
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\assembly.dll" hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration>
In Azure WebApp the HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
error it seams to be cause by InProcess
hosting model and module AspNetCoreModuleV2
Upvotes: 10
Reputation: 41
I've tried publishing as "self-contained" and modifying the web.config, however, nothing worked.
After further research I've found out about the "App Service Editor" tool in Azure. Having a look to the output errors I've realised the issue was to do with the database firewall blocking "my" IP. I had added a rule with my IP previously, however, the IP shown in the error message was different to my actual IP, for some reason. Once the I added another rule on the database with this IP, it worked immediately.
Another strange thing is that the error reported by the "Diagnose and solve problems" tool (AspNetCoreModuleV2) had not much to do with the actual issue.
Thanks everyone for taking the time to answer my question.
Upvotes: 2
Reputation: 1811
You can try change web.config directly on Azure, so when you deploy application go to the web.config and replace AspNetCoreModuleV2
to AspNetCoreModule
. Changing web.config directly will restart application poll, just to understand what is problem.
Please see same article, with possible solutions:
AspNetCore 3.0 - HTTP Error 500.0 - ANCM In-Process Handler Load Failure
Upvotes: 0
Reputation: 5791
Have a check under the PublishProfiles
folder (inside Properties
) and ensure you have :
<SelfContained>true</SelfContained>
A self-contained application distributes the runtime with the application.
Upvotes: 1