HTTP错误500.30-ANCM进程内启动失败

时间:2019-07-22 11:26:59

标签: asp.net-core hosting web-deployment asp.net-core-webapi iis-8

我无法将aspcore 2.2 api部署到IIS。

我尊重我在官方文档网站上找到的所有说明: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2

*****Program.cs*******

            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .Build();




            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService<DefaultContext>();
                    DefaultDbInitializer.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService<ILogger<Program>>();
                    logger.LogError(ex, "An error occurred while seeding the database.");
                }
            }
            host.Run();
*****MyProject.csproj*******
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.3.1" />
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\IXIBF.Commons\IXIBF.Commons.csproj" />
    <ProjectReference Include="..\IXIBF.DatabaseAccess\IXIBF.DatabaseAccess.csproj" />
    <ProjectReference Include="..\IXIBF.Resources\IXIBF.Resources.csproj" />
    <ProjectReference Include="..\IXIBF.Services\IXIBF.Services.csproj" />
  </ItemGroup>

</Project>
***** web.config****
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\IXIBF.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" >
         <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
    </aspNetCore>
    </system.webServer>
  </location>
</configuration>

HTTP错误500.30-ANCM进程内启动失败 此问题的常见原因: 应用程序无法启动 应用程序启动但随后停止 该应用程序已启动,但在启动过程中引发了异常 故障排除步骤: 检查系统事件日志中是否有错误消息 启用记录应用程序进程的标准输出消息 将调试器附加到应用程序进程并检查

0 个答案:

没有答案