When I try and startup my ASP.NETcore 1.1 on my server I get the error:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port
I checked the event viewer.
Application: MyApp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileLoadException at MyApp.Program.Main(System.String[])
MyApp.Program.Main
is
public class Program
{
public static void Main(string[] args)
{
Console.Title = "IdentityServer";
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("http://localhost:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
This is based on the Identity Server 4 code.
Stdout
has
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting, Version=1.1.0.0
I have added Microsoft.AspNetCore.Hosting via NuGet to my project. Microsoft.AspNetCore.Hosting.dll
is in my published files...
After doing some more digging I found this post Can't load Microsoft.AspNetCore.Hosting 1.1.0.0 #1826. It suggests to remove app.AddBrowserLink();
. AddBrowserLink()
is not used at all in my code.
By commenting out code the error seems to come when I reference a project that is not .NET Core based that depends on traditional .NET.
I am using Visual Studio 2017.
Hansleman had the answer from his post How to reference an existing .NET Framework Project in an ASP.NET Core 1.0 Web App.
I had created an ASP.NET Core 1.1 app pointing to .NET Core. I recreated my website as ASP.NET Core 1.1 and had it point to .NET Framework and then the code that was failing ran.