Asp.net
ASP.NET Core 發布錯誤:啟動應用程序時出錯
我嘗試在 Windows Server 2008 R2 上發布我的 ASP.NET Core 應用程序,但我收到此錯誤:“啟動應用程序時發生錯誤。”
沒有更多的描述!
我能做些什麼?
請看一下這篇文章:https ://scottsauber.com/2017/04/10/how-to-troubleshoot-an-error-occurred-while-starting-the-application-in-asp-net-core- on-iis它將為您提供一個很好的入門工具包,以便在出現此類錯誤時獲取基本日誌資訊。
這可能是錯誤的啟動配置或與安裝的 .NET Core 執行時有關,但如果沒有更多技術資訊,很難說。
這不是一個真正的錯誤。你必須找到真正的錯誤。要查看真正的錯誤,請執行以下操作。請記住,一旦確定問題並修復它,您就必須撤消這些更改。您不應該向最終使用者顯示真正的錯誤。
在您的開發環境中,嘗試將其添加/更新到 web.config 以查看真正的錯誤
<aspNetCore processPath=".\MyApplication.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> </environmentVariables> </aspNetCore>在您的 program.cs 添加/更新下面查看真正的錯誤
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .CaptureStartupErrors(true) .UseSetting("detailedErrors", "true") .UseStartup<Startup>() .Build();