gpt4 book ai didi

c# - HTTP 错误 500.35 - 同一进程 ASP.NET Core 3 中的 ANCM 多个进程内应用程序

转载 作者:太空狗 更新时间:2023-10-29 21:37:23 24 4
gpt4 key购买 nike

从今天早上开始,项目代码没有任何变化,一个非常简单的 Web API,一个 Controller 和 3 个方法,使用 Swagger,它不再启动,我得到错误:

HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process

事件查看器报告最无用的消息:

IIS Express AspNetCore Module V2: Failed to start application '/LM/W3SVC/2/ROOT/docs', ErrorCode '0x80004005'.

多次重启系统。

我使用的是 Visual Studio 2019,应用程序已成功编译,几分钟前它运行良好。没有安装新软件,也没有添加软件包。还尝试清理和重建。

我刚刚修改了一个方法的注释。显然,我也尝试过恢复之前的评论,但我总是收到相同的消息。

我能做什么?

net core 还是太不稳定,不能专业使用吗?

更新

从同一版本的 Visual Studio 启动但在另一台 PC 上运行的相同代码可以正常运行。

更新 2

应用程序代码下方:

启动.cs

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using System;
using System.IO;
using System.Reflection;

namespace WFP_GeoAPIs
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{

services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo() { Title = "Geographic APIs", Version = "v1.0.0" });
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.XML";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "swagger-ui")),
RequestPath = "/swagger-ui"
});

app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});

app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "GeoAPIs Ver 1.0.0");
c.RoutePrefix = "docs";
c.InjectStylesheet("/swagger-ui/custom.css");
});
}
}
}

这是 launchsettings.json:

{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51319",
"sslPort": 44345
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "docs",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WFP_GeoAPIs": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "docs",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

但是在另一台具有相同 Visual Studio 版本的 PC 上处理该项目工作正常,所以它看起来像是 .NET Core 或 VIsual Studio 属性中的配置错误...

最佳答案

目前是bug在 VS2019 中 -(2019 年 11 月 4 日)

1.)关闭您的解决方案

2.)删除.vs文件夹中的applicationhost.config删除整个。 vs 文件夹。

.vs 文件夹是一个隐藏文件夹,通常位于您的解决方案文件旁边。

enter image description here

3.) 重新启动您的解决方案

关于c# - HTTP 错误 500.35 - 同一进程 ASP.NET Core 3 中的 ANCM 多个进程内应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58246822/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com