2017-10-04 109 views
2

我开始使用asp.net核心2.0 使用VS 2017创建了一个新项目。将它发布到Windows Azure。我得到了错误的IIS 502.5 enter image description hereasp.net核心2.0发布到azure获取IIS 502.5错误

检查日志流,我看到这个

未处理的异常信息:System.FormatException:短开关“-argFile”没有在交换机映射定义。 在Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load() 在Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1提供商) 在Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() 微软。 AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException & hostingStartupErrors) 在Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() 在RecruitmentStore.Host.Program.BuildWebHost(字串[] args)在d:\ RecruitmentStore \ RecruitmentStore.Host \ Program.cs:line 20 at RecruitmentStore.Host.Program.Main(String [] args)in D:\ RecruitmentStore \ RecruitmentStore.Host \ Program.cs:line 17

IIS详细 错误 - 502.5 - 坏网关

这里是我的web.config

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.webServer> 
    <handlers> 
     <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> 
    </handlers> 
    <aspNetCore requestTimeout="00:20:00" 
       processPath="bin\IISSupport\VSIISExeLauncher.exe" 
       arguments="-argFile IISExeLauncherArgs.txt" 
       forwardWindowsAuthToken="false" 
       stdoutLogEnabled="true" 
       stdoutLogFile="\\?\%home%\LogFiles\stdout"/> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 
</configuration> 

我看到的bin文件夹内IISExeLauncherArgs.txt产生的文件(在我的地方),但不知道它如何在Azure中工作。

enter image description here

你能告诉我怎么解决这一问题?我没有重新启动应用程序服务几次,不利于

+0

请后输出作为** **的文字,而不是文字的截图测试这一点。这使得每个人都更容易:) –

+0

好吧,我编辑了我的问题,谢谢 – khoailang

+0

这是由VS创建的未经修改的默认核心2.0应用程序? web.config通常没有所有这些额外的开关,所以关于如何部署它有一些不寻常的事情。 –

回答

3

我们发现,问题是,你必须作为项目一web.config在Visual Studio调试本地时只是为了使用的一部分。如果从项目中排除它,则msbuild将在部署时生成正确的一个,并且它将在Azure上正确运行。

+0

创建了一个问题来跟踪此问题:https://github.com/aspnet/websdk/issues/242 –

+0

删除web.config并未导致我的服务器上生成web.config ... –

+0

@DavidvanDugteren yes在与VS专家交谈后,他的结论是,真正的原因可能是VS发布问题,这就是他提交这个问题的原因(https://github.com/aspnet/websdk/issues/242)。 –