Azure Web生成HTTP错误502.3-代码0x80072f7,指定的CGI应用程序遇到错误,服务器终止了该过程。
运行命令dotnet run
502-Web服务器在充当服务器时收到无效响应 网关或代理服务器。
您所在的页面有问题 寻找,并且无法显示。当Web服务器(同时 充当网关或代理)联系了上游内容服务器, 它收到了来自内容服务器的无效响应。
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry();
services.AddDbContext<Context>(opt =>
opt.UseInMemoryDatabase("ConfigurationList"));
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info
{
Title = "Gateway API",
Version = "v1",
Description = "CRUD",
TermsOfService = "None",
Contact = new Contact
{
Name = ",
Email = "@alt-f1.be",
Url = "https://twitter.com/abdelkrim"
},
License = new License
{
Name = "(c) Copyright 2019, all rights reserved.",
Url = "http://www.alt-f1.be"
}
});
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
services.AddSingleton<IAPI, API>();
services.AddSingleton<IAPIMandate, APIMandate>();
services.AddSingleton<IApiRules, ApiRules>();
services.AddSingleton<IApiTransactions, ApiTransactions>();
Console.WriteLine("scoped api");
}
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
答案 0 :(得分:0)
缺少一些环境变量,并且执行了一些代码,使WebApp崩溃了。
if (Environment.GetEnvironmentVariable("a-token") == null)
{
...
Environment.Exit(-1);
}
这是日志不可用的原因