加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net核心2.0发布到azure得到IIS 502.5错误

发布时间:2020-12-16 03:31:30 所属栏目:asp.Net 来源:网络整理
导读:我从asp.net core 2.0开始 用VS 2017创建了一个新项目.将它发布到 windows azure.我收到错误IIS 502.5 检查日志流,我看到了这一点 Unhandled Exception: System.FormatException: The short switch ‘-argFile’ is not defined in the switch mappings. at
我从asp.net core 2.0开始
用VS 2017创建了一个新项目.将它发布到 windows azure.我收到错误IIS 502.5

enter image description here

检查日志流,我看到了这一点

Unhandled Exception: System.FormatException: The short switch ‘-argFile’ is not defined in the switch mappings.
at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at RecruitmentStore.Host.Program.BuildWebHost(String[] args) in D:RecruitmentStoreRecruitmentStore.HostProgram.cs:line 20
at RecruitmentStore.Host.Program.Main(String[] args) in D:RecruitmentStoreRecruitmentStore.HostProgram.cs:line 17

IIS Detailed
Error – 502.5 – Bad Gateway

这是我的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="binIISSupportVSIISExeLauncher.exe" 
                arguments="-argFile IISExeLauncherArgs.txt" 
                forwardWindowsAuthToken="false" 
                stdoutLogEnabled="true" 
                stdoutLogFile="?%home%LogFilesstdout"/>
    <directoryBrowse enabled="true" />
  </system.webServer>
</configuration>

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

enter image description here

你能告诉我如何解决这个问题吗?我确实多次重启了应用服务,这没有用

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读