Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core 在RHEL 7中运行ASP.NET内核的问题_Asp.net Core_Rhel_Rhel7 - Fatal编程技术网

Asp.net core 在RHEL 7中运行ASP.NET内核的问题

Asp.net core 在RHEL 7中运行ASP.NET内核的问题,asp.net-core,rhel,rhel7,Asp.net Core,Rhel,Rhel7,我已经在Visual Studio 2017中构建并发布了一个ASP.NET Core应用程序,目标是ASP.NET Core 2.2.8运行时。当我将(xcopy)部署到RedHat并尝试在Kestrel中运行时,我得到以下错误: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.AspNetCore.Server.Kestrel.Core, Versi

我已经在Visual Studio 2017中构建并发布了一个ASP.NET Core应用程序,目标是ASP.NET Core 2.2.8运行时。当我将(xcopy)部署到RedHat并尝试在Kestrel中运行时,我得到以下错误:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The module was expected to contain an assembly manifest.
这是我的.csproj文件中的内容:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <Platforms>x64</Platforms>
    <MicrosoftNETPlatformLibrary>Microsoft.NETCore.App</MicrosoftNETPlatformLibrary>
  </PropertyGroup>
  <ItemGroup>                                                                            
    <Content Update="appsettings.json;web.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.8" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.8" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Update="Microsoft.NETCore.App" Version="2.2.8"/>
  </ItemGroup>
</Project>

netcoreapp2.2
过程中
x64
Microsoft.NETCore.App
保存最新

我在RedHat文档中发现RedHat不提供ASP.NET Core 2.2托管捆绑包。相反,RedHat建议执行一个自包含的构建,并将所有文件(大约400个)复制到应用程序文件夹中。RedHat通过在其.NET核心RPM中包含主机包,用3.0解决了这一问题

ASP.NET核心共享框架在RHEL上不可用。部署的ASP.NET核心应用程序必须包括ASP.NET核心包


您可以使用
dotnet new mvc
创建一个普通项目,然后比较当前项目。我刚刚通过Kestrel成功部署并运行了一个自包含的RedHat构建。要复制的文件太多了。它确认了问题在于依赖项解决。它在Kestrel服务器上本地运行。