.net核心api将服务器2008 r2上的.net框架作为目标IIS7 ANCM进程外错误

时间:2019-06-26 16:36:24

标签: c# .net-core-2.2

我已经在.net core 2.2上运行了一个针对.net Framework 4.6.2的API。它运行在带有IIS 7的2008 R2服务器上。我已经安装了2.2.5,.net框架4.7.2和C ++ 2017框架的托管捆绑包(我还安装了C ++ 2015)。该应用程序将在我本地安装的IIS(Win 10开发计算机)上运行,但是当我部署并尝试用Postman来运行该应用程序时,出现500 ANCM进程外错误。 我还向服务器上载了一个超级基本的现成的.netcore Web应用程序,并获得了相同的结果。

当我从本地IIS安装(Dev Workstation是Win 10)运行该应用程序时,它可以运行

我已经尝试修复,卸载和重新安装所有关联的框架。我已将代码从64位切换到32位。我已删除了代码中不必要的部分(identityserver 4授权)。

这是我的.csproj:

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

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <RuntimeIdentifiers>win7-x86</RuntimeIdentifiers>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <PlatformTarget>x86</PlatformTarget>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="ActiveDirectoryAPI.csproj.vspscc" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="AntiXSS" Version="4.3.0" />
    <PackageReference Include="EntityFramework" Version="6.2.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.1" />
    <PackageReference Include="Serilog" Version="2.8.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
    <PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
    <PackageReference Include="System.DirectoryServices" Version="4.5.0" />
    <PackageReference Include="System.DirectoryServices.AccountManagement" Version="4.5.0" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="ESA.WebTeam.AuthorizationManager.Data">
      <HintPath>..\References\ESA.WebTeam.AuthorizationManager.Data.dll</HintPath>
    </Reference>
    <Reference Include="ESA.WebTeam.AuthorizationManager.Model">
      <HintPath>..\References\ESA.WebTeam.AuthorizationManager.Model.dll</HintPath>
    </Reference>
  </ItemGroup>

</Project>

这是我的program.cs(“#remote server location#”不是字面意思,我遇到的较早的问题之一是IIS无法定位应用程序文件,因此其中包含发布位置,确保有更好的方法可以做到这一点,但我想以后可以解决):

 public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseKestrel()
                .UseStartup<Startup>()
                .UseIISIntegration()
                .UseContentRoot("#remote server location#");
    }

这是我的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=".\ActiveDirectoryAPI.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
        <environmentVariables />
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 466df6a6-c3b8-4f13-ab7a-3b35e39075c2-->

由于正在使用身份授权,但是身份服务器尚未发布(它也是.net核心,因此无法正常工作),我希望获得未经授权的401-这就是我得到的信息本地IIS实例。

0 个答案:

没有答案