Asp Core Self Hosted не работает после обновления версии с Asp Core 3.0 до 3.1 - PullRequest
0 голосов
/ 16 марта 2020

У меня проблема после обновления Asp Core Web Api с Net Core 3.0 до 3.1. Я размещаю свой проект через IIS на Windows Server 2016 как OutOfProcess. В режиме отладки в Visual Studio все работает, но при развертывании приложения на сервере я получаю сообщение об ошибке, как показано ниже.

Я также обновил ASP. NET Core 3.1 Runtime (v3. 1.2) - Windows Установщик Hosting Bundle до последней версии на сервере.

2020-03-16 10:36:06.8422 - Fatal - 1/ - Microsoft.AspNetCore.Hosting.Diagnostics - Application startup exception System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Authentication.Negotiate, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.AspNetCore.Authentication.Negotiate, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at ProjectCatalogConfigApi.Startup.ConfigureServices(IServiceCollection services)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)

Это мой asp .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=".\ProjectCatalogConfigApi.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: bcf66aa7-8e13-4a24-8aec-1dd730428577-->

И мой csproj

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

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>


  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="3.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
    <PackageReference Include="NLog" Version="4.6.8" />
    <PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
    <PackageReference Include="NSwag.AspNetCore" Version="13.2.3" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\PCC.Api.Model\PCC.Api.Model.csproj" />
    <ProjectReference Include="..\PCC.DataStorage.Services\PCC.DataStorage.Services.csproj" />
    <ProjectReference Include="..\PCC.DataStorage\PCC.DataStorage.csproj" />
    <ProjectReference Include="..\PCC.Services.Contracts\PCC.Services.Contracts.csproj" />
    <ProjectReference Include="..\PCC.Services\PCC.Services.csproj" />
    <ProjectReference Include="..\PCC.Shared\PCC.Shared.csproj" />
    <ProjectReference Include="..\PCC.Wtms.Api.Client\PCC.Wtms.Api.Client.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Exceptions\" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Pages\AcceptInfoPage.cs">
      <DependentUpon>AcceptInfoPage.tt</DependentUpon>
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <None Update="Pages\AcceptInfoPage.tt">
      <LastGenOutput>AcceptInfoPage.cs</LastGenOutput>
      <Generator>TextTemplatingFilePreprocessor</Generator>
    </None>
  </ItemGroup>

  <ItemGroup>
    <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
  </ItemGroup>

</Project>

И мои публикации sh Параметры enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...