我正在构build一个基于Ubuntu的服务器托pipe的.Net核心API。 我正在服务器上安装我需要的软件包,比如MySQL和Nginx,但是我也需要安装.Net Core,当然是为了运行应用程序。
我find了一个如何设置和configurationNginx与Kestrel服务器配合的教程示例 ,但是它完全假设您已经在要部署的计算机上安装了.Net Core。
.Net Core网站似乎只是指导你安装SDK,但是这是为了部署,而不是开发,所以安装.Net Core运行时是有道理的,但是在做一个apt-cache search dotnet来find特定的包名,我发现也列出了“Microsoft .NET Core 2.0.0 Linux Server Hosting”的dotnet-hosting-2.0.0 。
总而言之,我的问题就是这个。 要托pipe.Net核心应用程序,是否使用dotnet-hosting或dotnet-runtime软件包来部署.Net Core应用程序?
经过进一步的研究,我发现dotnet-hosting软件包结合了dotnet-runtime和aspnetcore-store软件包。 经Github评论validation。
运行时和运行时存储打包到“Linux Server Hosting”安装程序中,软件包名称为
dotnet-hosting-2.0.0。
aspnetcore-store现在默认为发布的ASP.Net核心应用程序所需的依赖项 。
默认情况下,ASP.NET应用程序在运行时存储上依赖发布。
所以要直接回答我的问题,在部署一个ASP.Net核心应用程序时,应该安装dotnet-hosting-xxx 。 当aspnetcore-store未与dotnet-runtime软件包一起安装时,这也将消除以下错误。
Error: An assembly specified in the application dependencies manifest (APIproject.deps.json) was not found: package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1' path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll' This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml
我已经用我的应用程序在Ubuntu 16.04上自己testing了这个软件包,它运行良好。