我正在尝试运行此REST API,但不断出现以下错误:
HTTP Error 500.30 - ANCM In-Process Start Failure
我试图将.net core从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更改为outprocesses,然后将错误更改为 处理失败,所以我将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>
我的statrtup.cs文件如下:
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
任何帮助将不胜感激。