Search code examples
iisasp.net-coreasp.net-identity

ASP.NET Core 2.0 - HTTP Error 502.5 Process Failure with IIS


I am trying to set up a new version of my application on a server but when I try to access to the web site, I get a HTTP error (502.5 - Process Failure).

The service is started and when I check the connection, I don't have any warning. enter image description here

The stdout log :

Expression: [Recursive resource lookup bug]
Description: Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: ArgumentNull_Generic

If I try the dotnet cmd to launch the exe :

>dotnet Maquetteur.Web.exe
Failed to load the dll from [C:\temp\MaquetteurWinServer2012_new\hostpolicy.dll], HRESULT: 0x7BF030
An error occurred while loading required library hostpolicy.dll from [C:\temp\MaquetteurWinServer2012_new\]

In my csproj :

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <UserSecretsId>3a51662b-79e6-4d37-be0c-c1e406dae19c</UserSecretsId>
    <RuntimeIdentifiers>win7-x64;linux-x64;win8-x64</RuntimeIdentifiers>
    <Version>0.2.0</Version>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="6.2.2" />
    <PackageReference Include="CoreCompat.System.Drawing" Version="1.0.0-beta006" />
    <PackageReference Include="jQuery.filedrop" Version="1.0.1" />
    <PackageReference Include="jQuery.UI" Version="1.12.1.1" />
    <PackageReference Include="jQuery.UI.Combined" Version="1.12.1" />
    <PackageReference Include="jQWidgets.AspNetCore.Mvc.TagHelpers" Version="2.0.1" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.4" />
    <PackageReference Include="MySql.Data" Version="8.0.11" />
    <PackageReference Include="NLog.Web.AspNetCore" Version="4.5.4" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" />
    <PackageReference Include="NSwag.Core" Version="11.17.17" />
    <PackageReference Include="SoapCore" Version="0.9.7" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="2.5.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="2.5.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="2.5.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="2.5.0" />
    <PackageReference Include="ZXing.Net" Version="0.16.4" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <Content Update="nlog.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ProjectExtensions>
    <VisualStudio>
      <UserProperties appsettings_1json__JSONSchema="" />
    </VisualStudio>
  </ProjectExtensions>
</Project>

And my publisher file :

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <ProjectGuid>7a5caaf4-d505-435a-8215-a59e69b5fe5e</ProjectGuid>
    <publishUrl>C:\temp\MaquetteurWinServer2012</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifier>win8-x64</RuntimeIdentifier>
  </PropertyGroup>
</Project>

I tried different ways to resolve my problem withou success... I can launch it in Debug and Release mode in visual studio.

I think it is a problem with Identity Core because I added it in this new version. Before Identity, I didn't have any problem to set up a new version on my server.

The specs :

Dev
- Visual Studio Community 2017 v15.7.5
- EF Core 2.0.0

Server
- Windows Server 2012 R2
- Runtime .Net Core App 2.0.7

I have maybe missed some information.

Have you an idea why I have this error ?


Solution

  • I found a solution for my problem.

    It was the NLOG dll which causes this problem. I checked what changed between the new version and the other and one of te modifications was the NLOG implementation. I removed it, publish a new version and put it on my server. It worked without errors ! I don't know if the dll is not compatible with my setup or if I used it badly in my program.cs. I will need to do some tests to try to implement this dll again... or just find an other logging dll :)