将面向.Net Framework 4.62的.Net Core应用程序部署到Azure

时间:2017-09-01 06:28:12

标签: .net azure

我们使用.Net Core Web模板在VS 2017中创建了一个应用程序。我们意识到我们实际上需要引用一些完整框架包的包。

所以我们将目标框架更改为4.6.2。

然而,现在当web应用程序部署到azure时,我一直收到错误:

HTTP错误502.5 - 进程失败 这个问题的常见原因: 申请流程未能启动 应用程序进程已启动但随后停止 应用程序进程已启动但无法侦听已配置的端口 故障排除步骤 检查系统事件日志以获取错误消息 启用日志记录应用程序进程的stdout消息 将调试器附加到应用程序进程并进行检查 有关更多信息,请访问: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>

我启用了日志记录。

azure调试控制台上事件登录中的错误如下:

<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 错误代码0x00000000 请求的网址http://GenIdentityServer:80/favicon.ico 物理路径D:\ home \ site \ 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)

1 个答案:

答案 0 :(得分:0)

好的,我没有意识到这已被添加到代码中:

//。使用WebListener(options =&gt;                     // {                     // options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM;                     // options.ListenerSettings.Authentication.AllowAnonymous = true;                     //})

当然不会在azure上工作!