Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.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
C# 在Debian上发布后无法运行ASP.NET核心API_C#_Api_Asp.net Core_.net Core - Fatal编程技术网

C# 在Debian上发布后无法运行ASP.NET核心API

C# 在Debian上发布后无法运行ASP.NET核心API,c#,api,asp.net-core,.net-core,C#,Api,Asp.net Core,.net Core,我创建了基本的ASP.Net核心API应用程序,我希望通过Apache在debian上运行该应用程序。除了.csproj之外,我没有更改默认应用程序(创建新项目时生成的应用程序)中的任何内容: <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <RuntimeIden

我创建了基本的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.0/debian-x64
返回此错误:

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
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有问题。

请参见:用户建议从命令行发布:dotnet publish-c release-r ubuntu.16.04-x64谢谢,帮助!