仅在Linux Core上运行时存储错误

我正在更新从.NET Core 1.1到2.0的一些应用程序。 这些应用程序在本地工作正常,但在更新Linux VM上的运行时并部署后,出现错误:

未find应用程序依赖项清单(foo.deps.json)中指定的程序集:package:'Microsoft.ApplicationInsights.AspNetCore',版本:'2.1.1'path:'lib / netstandard1.6 / Microsoft.ApplicationInsights.AspNetCore .DLL”
该程序集预计在本地运行库中,因为应用程序是使用以下目标清单文件发布的: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

我认为这是因为运行时下载不会生成使用Microsoft.AspNetCore.All软件包时所需的新运行时存储文件夹。

我可以安装整个SDK,而且这个工作正常,但我宁愿继续只使用运行时。

如何在不需要生产服务器上的SDK的情况下手动生成运行时caching?

Solutions Collecting From Web of "仅在Linux Core上运行时存储错误"

您可以从这里下载ASP.NET Core运行时存储:

https://dist.asp.net/runtimestore/2.0.0/linux-x64/aspnetcore.runtimestore.tar.gz

您还需要下载.NET Core 2.0.0运行时(请参阅https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md )。

将这两个文件解压缩到相同的文件夹中,即运行时存储归档文件中的“store”和“additionalDeps”文件夹应该与dotnet可执行文件并行。

更新10/3/2017

您也可以从包饲料安装。

请参阅此链接以获取有关为apt,yum,zypper等添加.NET Core软件包的说明: https : //github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0 -download.md#安装净芯上的Linux

例如,如果你想在Ubuntu 16上安装,你可以这样做:

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list' sudo apt update sudo apt install aspnetcore-store-2.0.0 

对于CentOS 7,以下工作适合我:

  1. 下载并安装运行时:

    mkdir -p / home / dotnet && tar zxf dotnet-runtime-2.0.0-linux-x64.tar.gz -C / home / dotnet

  2. 下载并安装SDK“ 这是一个必须获得Asp.Net Core存储文件夹

    mkdir -p / home / dotnetSDK && tar zxf dotnet-sdk-2.0.0-linux-x64.tar.gz -C / home / dotnetSDK

  3. 将存储文件夹从SDK复制到运行时:

    cp -rp / home / dotnetSDK / store / home / dotnet / store

  4. 删除SDK:

    rm -dfr / home / dotnetSDK

  5. 按照官方文档中的说明设置'dotnet'到PATH(下面不是永久的):

    export PATH = $ PATH:/ home / dotnet

现在您可以测试并确认其工作:

 # dotnet WebApiTest.dll info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest. info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58] Creating key {87d17c5a-120f-4204-b316-52027a264791} with creation date 2017-08-17 16:34:49Z, activation date 2017-08-17 16:34:49Z, and expiration date 2017-11-15 16:34:49Z. warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {87d17c5a-120f-4204-b316-52027a264791} may be persisted to storage in unencrypted form. info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39] Writing data to file '/root/.aspnet/DataProtection-Keys/key-87d17c5a-120f-4204-b316-52027a264791.xml'. Hosting environment: Production Content root path: /home/dotnet/WebApiTest Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. 

最后:压缩/归档/ home / dotnet,以便在相同版本-2.0.0的将来部署不需要步骤2,3和4。

根据Runtime包存储文档 ,可以将以下内容添加到.csproj文件中:

 <PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup> 

并且在使用dotnet publish时,依赖关系将被包含。