Rest HTTP错误500.30-在.net core 2.2中ANCM进程内启动失败

Rest HTTP错误500.30-在.net core 2.2中ANCM进程内启动失败,rest,api,.net-core,Rest,Api,.net Core,我正在尝试运行此REST API,但不断出现以下错误: HTTP Error 500.30 - ANCM In-Process Start Failure 我试图将.NETCore从2.2.0升级到2.2.5。2.2.0是Visual studio的默认版本。我正在Visual studio 2019中编写此代码 我还从以下网站下载了dotnet托管包: https://dotnet.microsoft.com/download/dotnet-core/2.2 我下载了V2.2.5版本,并为

我正在尝试运行此REST API,但不断出现以下错误:

HTTP Error 500.30 - ANCM In-Process Start Failure
我试图将.NETCore从2.2.0升级到2.2.5。2.2.0是Visual studio的默认版本。我正在Visual studio 2019中编写此代码

我还从以下网站下载了dotnet托管包:

https://dotnet.microsoft.com/download/dotnet-core/2.2
我下载了V2.2.5版本,并为windows X64安装了SDK、ASP.NET Core Runtime 2.2.5和.NET Core Runtime 2.2.5

下面是屏幕截图

下面是我的dotnet信息的屏幕截图:

尽管下载了所有内容,我还是不断收到一个错误:

HTTP Error 500.30 - ANCM In-Process Start Failure
最后,我将csproj文件AspNetCoreHostingModel更改为outofprocesss,然后错误更改为 进程失败,因此我将csproj更改回原始文件

目前,我的csproj文件如下所示:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>

  <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>

  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="Microsoft.NETCore.App" Version="2.2.5" />
  </ItemGroup>

</Project>

我们将非常感谢您的帮助

如果我理解正确,您可以在IIS中托管应用程序。我建议在没有IIS的情况下直接通过Kestrel启动应用程序(dotnet“path\u to\u your\u executable\u dll”或简单的“path\u to\u your\u executable\u exe”)。如果应用程序启动正确,问题在于IIS(ASP_网络核心模块等-请参阅)。如果错误仍然存在,您可能会得到额外的输出。2.2已经过时,因此您不应该再使用它了。一旦切换到受支持的版本并可以重现此问题,请运行一些基本诊断并编辑问题以包括该问题,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using RecLoadAPI.Models.DB;
namespace RecLoadAPI
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddDbContext<db_recloadContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            // app.UseHttpsRedirection();
            app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            app.UseMvc();
        }
    }
}
https://stackoverflow.com/questions/53811569/http-error-500-30-ancm-in-process-start-failure