【发布时间】:2017-08-27 17:27:12
【问题描述】:
当我尝试在我的服务器上启动我的 ASP.NETcore 1.1 时,我收到了错误:
HTTP 错误 502.5 - 进程失败
此问题的常见原因:
申请进程启动失败申请进程 已启动但随后停止 应用程序进程已启动但未能 监听配置的端口
我检查了事件查看器。
应用程序:MyApp.exe 框架版本:v4.0.30319 描述: 由于未处理的异常,进程被终止。异常信息: MyApp.Program.Main(System.String[]) 处的 System.IO.FileLoadException
MyApp.Program.Main是
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();
}
}
这是基于 Identity Server 4 的代码。
Stdout有
未处理的异常:System.IO.FileLoadException:无法加载文件 或程序集 'Microsoft.AspNetCore.Hosting, Version=1.1.0.0
我已通过 NuGet 将 Microsoft.AspNetCore.Hosting 添加到我的项目中。 Microsoft.AspNetCore.Hosting.dll 在我发布的文件中...
在进行了更多挖掘之后,我发现了这篇文章Can't load Microsoft.AspNetCore.Hosting 1.1.0.0 #1826。它建议删除app.AddBrowserLink();。我的代码中根本没有使用AddBrowserLink()。
通过注释掉代码,当我引用一个不基于 .NET Core 且依赖于传统 .NET 的项目时,似乎会出现错误。
我正在使用 Visual Studio 2017。
【问题讨论】:
-
您是否尝试过添加对
Microsoft.AspNetCore.Server.Kestrel的引用?
标签: c# asp.net-core visual-studio-2017 identityserver4 asp.net-core-1.1