我們使用.Net Core Web模板在VS 2017中創建了一個應用程序。我們自從意識到我們實際上需要引用一些包含完整框架包的包。部署以.Net Framework 4.62爲目標的.Net Core應用程序到Azure
因此我們將目標框架更改爲4.6.2。
但是現在,當Web應用程序部署到蔚藍,我一直得到錯誤:
HTTP錯誤502.5 - 進程失敗這個問題的 常見原因: 應用程序未能啓動 申請程序開始,但隨後停止 申請程序開始,但未能偵聽的配置端口 故障排除步驟: 檢查系統事件日誌中的錯誤消息 啓用日誌,應用程序進程的標準輸出的消息 一個調試器附加到應用程序和檢查 欲瞭解更多信息,請訪問:https://go.microsoft.com/fwlink/?LinkID=808681
它似乎無法啓動,但我不確定我需要做些什麼改變才能使其工作。
當我發佈一個web.config文件被創建了服務器,它包含此有關:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--ProjectGuid: db77cdb1-05c4-450e-94d8-5dabc48c6d76-->
<system.webServer>
<handlers>
<add resourceType="Unspecified" modules="AspNetCoreModule" verb="*" path="*" name="aspNetCore"/>
</handlers>
<aspNetCore stdoutLogFile=".\logs\stdout" stdoutLogEnabled="true" processPath=".\Genesis.IdentityServer.exe"/>
</system.webServer>
</configuration>
我啓用了日誌記錄。
事件中的錯誤日誌了蔚藍的調試控制檯如下:
<Event>
<System>
<Provider Name=".NET Runtime"/>
<EventID>1026</EventID>
<Level>0</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2017-09-01T06:14:38Z"/>
<EventRecordID>868107718</EventRecordID>
<Channel>Application</Channel>
<Computer>RD0003FFC3731F</Computer>
<Security/>
</System>
<EventData>
<Data>Application: Genesis.IdentityServer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: Microsoft.Net.Http.Server.WebListenerException at Microsoft.Net.Http.Server.ServerSession..ctor() at Microsoft.Net.Http.Server.WebListener..ctor(Microsoft.Net.Http.Server.WebListenerSettings) at Microsoft.AspNetCore.Server.WebListener.MessagePump..ctor(Microsoft.Extensions.Options.IOptions`1<Microsoft.AspNetCore.Server.WebListener.WebListenerOptions>, Microsoft.Extensions.Logging.ILoggerFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceProvider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.__Canon) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceProvider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(Microsoft.Extensions.DependencyInjection.ServiceLookup.SingletonCallSite, Microsoft.Extensions.DependencyInjection.ServiceProvider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.__Canon) at Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass16_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceProvider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(System.Type) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(System.IServiceProvider, System.Type) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.IServiceProvider) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at Genesis.IdentityServer.Program.Main(System.String[]) </Data>
</EventData>
</Event>
<Event>
<System>
<Provider Name="IIS AspNetCore Module"/>
<EventID>1000</EventID>
<Level>0</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2017-09-01T06:14:38Z"/>
<EventRecordID>868107937</EventRecordID>
<Channel>Application</Channel>
<Computer>RD0003FFC3731F</Computer>
<Security/>
</System>
<EventData>
<Data>Application 'MACHINE/WEBROOT/APPHOST/GENIDENTITYSERVER' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline 'D:\home\site\wwwroot\Genesis.IdentityServer.exe ', ErrorCode = '0x80004005 : e0434352.</Data>
</EventData>
</Event>
</Events>
這莫名其妙我,我能不能簡單地從我的.NET應用程序的核心目標框架462?
編輯
我打開詳細的錯誤,現在看到:
HTTP錯誤502.5 - 錯誤的網關 指定的CGI應用程序時遇到錯誤,服務器終止該進程。
最有可能的原因: CGI應用程序沒有返回一組有效的HTTP錯誤。 充當代理或網關的服務器由於父網關中的錯誤而無法處理該請求。
您可以嘗試的事情: 使用DebugDiag排除CGI應用程序故障。 確定代理或網關是否對此錯誤負責。
詳細錯誤信息: 模塊AspNetCoreModule 通知ExecuteRequestHandler 處理器aspNetCore 錯誤代碼0×00000000 請求的URL http://GenIdentityServer:80/favicon.ico 物理路徑d:\家\網站\ wwwroot的\的favicon.ico 登錄方法匿名 登錄用戶匿名
我試着圍繞WebHostBuilder()進行嘗試。建立呼叫,這是被記錄:
Access is denied at Microsoft.Net.Http.Server.ServerSession..ctor()
at Microsoft.Net.Http.Server.WebListener..ctor(WebListenerSettings settings)
at Microsoft.AspNetCore.Server.WebListener.MessagePump..ctor(IOptions`1 options, ILoggerFactory loggerFactory)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Genesis.IdentityServer.Program.Main(String[] args)
事件日誌中的堆棧跟蹤幾乎是不可讀的,出於某種原因,沒有與似乎是罪魁禍首的WebListenerException關聯的消息。我建議你用一個try-catch在你的Main方法中圍繞對'WebHostBuilder.Build()'的調用,然後記錄拋出的任何異常,以便讀取它(寫入'exception.ToString()'到日誌)。您可能會遇到'WebListenerException'的一個原因是因爲該進程試圖綁定到無法訪問或已被使用的端口。 –
我更新了這個問題,並在Azure的詳細錯誤日誌中看到了該錯誤 –