在Debian

时间:2018-04-24 15:52:02

标签: c# api asp.net-core .net-core

我创建了基本的ASP.Net核心API应用程序,我希望通过Apache在debian上运行,我没有更改默认应用程序(在创建新项目时生成),除了.csproj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifier>debian-x64</RuntimeIdentifier> <!-- NEW LINE -->
  </PropertyGroup>

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

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
  </ItemGroup>

</Project>

我将它发布到文件夹(它创建了两个文件夹:netcoreapp2.0PublishOutput)并将其转移到debian。在那里我运行了sudo apt-get install dotnet-runtime-2.0.6并试图在两个目录(./MyAppNamePublishOutput)中运行netcoreapp2.0/debian-x64

PublishOutput返回了此错误:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder..ctor()
   at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(String[] args)
   at MyAppName.Program.BuildWebHost(String[] args)
   at MyAppName.Program.Main(String[] args)
Aborted

netcoreapp2.0/debian-x64返回了此错误:

Error:
  An assembly specified in the application dependencies manifest (SrovnavacPojistoven.deps.json) was not found:
    package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1'
    path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'
如果有人可以帮助我,我会非常高兴。我找不到任何有用的东西。我试图发布基本的.net核心控制台应用程序,没有任何问题,我只有ASP的问题。

0 个答案:

没有答案