docker 在window 10 专业版的安装 && .net core 在docker的部署

时间:2024-11-07 19:07:44

1.如果无法安装Hyper-V,八成是自己的杀毒软件给关了,我的是 电脑管家-启动项里面 给关掉了。

2.如果部署.net core 后 运行 报

An assembly specified in the application dependencies manifest (tesat.deps.json) was not found:
package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1'
path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll',

找到源项目文件的.csproj文件,追加一个

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

追加完应该是这个样子:

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

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
<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>,重新发布问题解决。

3 . 如果部署成功,但是访问不到,报超时,

是因为 Docker for Windows makes whatever is running on port 80 in the container (in this case, nginx) available on port 80 of localhost,

docker run -p 8010:80 --name w4ebsser1svers hellowebapp.57

后面的80 不可改变,只改前面的 主机访问接口,即可访问的到。

具体 安装参考这位大神:https://www.cnblogs.com/Leo_wl/p/5666669.html#_label4