.net-core自包含发布的问题

时间:2017-02-12 23:59:34

标签: docker .net-core .net-standard-1.6

我正在尝试按照https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index中的步骤发布一个以.net-core制作的自包含应用。

包含代码的存储库位于https://github.com/fontanaricardo/httpecho

我执行命令:

$ch_git = curl_init(); 

curl_setopt($ch_git, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch_git, CURLOPT_HTTPHEADER, array('PRIVATE-TOKEN: xxx')); 
curl_setopt($ch_git, CURLOPT_URL, 'https://gitlab.com/api/v3/projects/xxx/repository/commits'); 
curl_setopt($ch_git, CURLOPT_POST, true);

$info = array(
    'id' => 'xxx',
    'branch_name' => 'master',
    'commit_message' => 'updating content...',
    'actions' => array(
        'action' => 'update', 
        'file_path' => 'filename',
        'content' => 'test 1234'
    )
);

$payload = json_encode($info, JSON_PRETTY_PRINT);

echo '<pre>';
echo $payload;
echo '</pre>';

curl_setopt($ch_git, CURLOPT_POSTFIELDS, $payload);

$res = curl_exec($ch_git);

echo '<pre>';
print_r(json_decode($res));
echo '</pre>';

启动容器:

$dotnet build -r debian.8-x64
$dotnet publish -c Release -r debian.8-x64
$docker build -t httpecho .

我做错了什么?

更新

发布文件夹中打开文件 httpecho.deps.json ,引用不存在的文件夹。

$ docker run -p 5000:5000 httpecho
Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.AspNetCore.Hosting.Abstracti
ons', version: '1.1.0', path: 'lib/netstandard1.3/Microsoft.AspNetCore.Hosting.Abstractions.dll'

1 个答案:

答案 0 :(得分:4)

您的设备在自包含的发布中有适当的distibute包的问题(试过我的工作得很好)。尝试按dotnet restore

修复包裹

Microsoft.AspNetCore.Http.Abstractions.dll中有debian.8-x64\publish吗?如果没有尝试手动添加(以及所有其他缺少* .dll&#39; s)然后尝试运行。如果它运行没有错误将是适当的distibute包

的问题