HTTP Error 502.5 - Process Failure - ASP.NET Core app deploy

1

I have a problem when I'm deploying my application to server.

I'm getting an error:

HTTP Error 502.5 - Process Failure

In log file I can see:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference.

Here's my project.json

    {
      "userSecretsId": "aspnet-travelingowe-c23d27a4-eb88-4b18-9b77-2a93f3b15119",
      "dependencies": {
        "Microsoft.AspNetCore.Diagnostics": "1.1.0",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
        "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
        "Microsoft.AspNetCore.SpaServices": "1.1.0-*",
        "Microsoft.AspNetCore.StaticFiles": "1.1.0",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
        "Microsoft.Extensions.Configuration.Json": "1.1.0",
        "Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
        "Microsoft.Extensions.Logging": "1.1.0",
        "Microsoft.Extensions.Logging.Console": "1.1.0",
        "Microsoft.Extensions.Logging.Debug": "1.1.0",
        "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
        "Microsoft.AspNetCore.Razor.Tools": {
          "version": "1.1.0-preview4-final",
          "type": "build"
        },
        "Microsoft.EntityFrameworkCore.Design": "1.1.0",
        "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
        "Hangfire.AspNetCore": "1.6.8",
        "HangFire.SqlServer": "1.6.8",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
        "Serilog": "2.4.0",
        "Serilog.Extensions.Logging": "1.4.0-dev-10138",
        "Serilog.Extensions.Logging.File": "1.0.1-dev-00008",
        "MailKit": "1.10.2",
        "Microsoft.AspNetCore.Mvc": "1.1.1",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
        "System.Xml.XDocument": "4.3.0",
        "Microsoft.Extensions.Configuration.Binder": "1.1.0",
        "System.Collections.Immutable": "1.3.0"
      },

      "tools": {
        "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
        "Microsoft.DotNet.Watcher.Tools": "1.1.0-preview4-final",
        "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final",
        "Microsoft.Extensions.SecretManager.Tools": "1.1.0-preview4-final",
        "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
      },

      "frameworks": {
        "netcoreapp1.1": {
          "dependencies": {
            "Microsoft.NETCore.App": {
              "type": "platform",
              "version": "1.1.0"
            }
          },
          "imports":
            "dnxcore50"
        }
      },

      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true,
        "compile": {
          "exclude": [ "node_modules" ]
        }
      },

      "runtimeOptions": {
        "configProperties": {
          "System.GC.Server": true
        }
      },

      "publishOptions": {
        "include": [
          "appsettings.json",
          "ClientApp/dist",
          "Views",
          "web.config",
          "wwwroot"
        ],
        "exclude": [
          "wwwroot/dist/*.map"
        ]
      },

      "scripts": {
        "prepublish": [
          "npm install",
          "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod",
          "node node_modules/webpack/bin/webpack.js --env.prod"
        ],
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
      },

  "tooling": {
    "defaultNamespace": "Travelingowe"
  }
}

Do you have any idea how to fix it ?

Update: Now I'm having an error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.Extensions.Configuration.EnvironmentVariables.EnvironmentVariablesConfigurationProvider.Load(IDictionary envVariables) at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at MyProject.Program.Main(String[] args) in E:\Projects\MyProject\Program.cs:line 15

As you can see above, it use local path on the server which I use locally. How Can I change it?

c#
asp.net
.net
iis
asp.net-core
asked on Stack Overflow Feb 18, 2017 by Cieja • edited Feb 19, 2017 by Cieja

4 Answers

1

Did you restart IIS after installing .NET Core Windows Server Hosting bundle?

This is how I normaly setup IIS to run .net core:

  • Install IIS Role
  • Install .net Core Windows Server Hosting bundle (https://go.microsoft.com/fwlink/?linkid=837808)
  • Restart IIS with net stop was /y and net start w3svc (or reboot machine)
  • Put publish output from VS to directory of Webpage
  • Change the .net clr version of application pool to "No Managed Code"
  • Restart applicaiton pool and webpage and it should work

Source: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis

answered on Stack Overflow Feb 18, 2017 by (unknown user)
0

It seems like project.json is referencing one of the package which is still not supported in .Net Core 1.1. Remove "System.Collections.Immutable": "1.3.0" from project.json because from Nuget gallery documentation, it looks like it is not yet supported on .net Core 1.1

answered on Stack Overflow Feb 20, 2017 by Pradeep Kumar
0

To solve it I added these lines to the .csproj file

<PropertyGroup>
       <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
answered on Stack Overflow Jul 9, 2018 by VĂ­ctor Melgar
0

IIS fails to run ASP.NET Core site - HTTP Error 502.5

Your problem is a bad web.config file:

<aspNetCore requestTimeout="02:00:00" 
     processPath="%LAUNCHER_PATH%" 
     arguments="%LAUNCHER_ARGS%" 
     stdoutLogEnabled="true" 
     stdoutLogFile=".\logs\stdout" 

answered on Stack Overflow Jul 9, 2018 by Pankaj Kumar

User contributions licensed under CC BY-SA 3.0