Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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# Can';t构建ASP.Net容器_C#_Asp.net_Docker_Dockerfile_Docker For Windows - Fatal编程技术网

C# Can';t构建ASP.Net容器

C# Can';t构建ASP.Net容器,c#,asp.net,docker,dockerfile,docker-for-windows,C#,Asp.net,Docker,Dockerfile,Docker For Windows,我正在尝试使用构建asp.NET4.6容器,但它不起作用 我正在使用。我将它复制到我的一个asp.net解决方案的根目录中 我运行了这个命令: Windows 10 version 1607 Docker for Windows: Version 17.06.1-ce-win24 (13025) 这是输出 $ docker build -t aspnet-site --build-arg site_root=/ 文档中确实有这样的说法(所以我试着对servicemonitor的内容进行注释,

我正在尝试使用构建asp.NET4.6容器,但它不起作用

我正在使用。我将它复制到我的一个asp.net解决方案的根目录中

我运行了这个命令:

Windows 10 version 1607
Docker for Windows: Version 17.06.1-ce-win24 (13025)
这是输出

$ docker build -t aspnet-site --build-arg site_root=/
文档中确实有这样的说法(所以我试着对servicemonitor的内容进行注释,结果成功了):

无需在Dockerfile中指定入口点,因为 microsoft/aspnet基本映像已包含入口点应用程序 用于监视IIS万维网发布服务的状态 (W3SVC)


请尝试使用此dockerfile。它将使用aspnet映像:

PS> docker build -t aspnet-site . --build-arg 'site_root=/'
Sending build context to Docker daemon  326.1MB
Step 1/6 : FROM microsoft/dotnet-framework:4.6.2
4.6.2: Pulling from microsoft/dotnet-framework
3889bb8d808b: Pull complete
9f5eeabe6154: Pull complete
Digest: sha256:c281f2c09c9446f1896806933013a350f19db8f5a009e633ebd9701c470de35b
Status: Downloaded newer image for microsoft/dotnet-framework:4.6.2
 ---> be84290c2315
Step 2/6 : SHELL powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';
 ---> Running in 1fd036b1b56e
 ---> 413164f1a97c
Removing intermediate container 1fd036b1b56e
Step 3/6 : RUN Add-WindowsFeature Web-Server;     Add-WindowsFeature NET-Framework-45-ASPNET;     Add-WindowsFeature Web-Asp-Net45;     Remove-Item -Recurse C:\inetpub\wwwroot\*
 ---> Running in 4b0e5751281b

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Common HTTP Features, Default Documen...
True    No             Success        {ASP.NET 4.6}
True    No             Success        {Application Development, ASP.NET 4.6,...


 ---> 9afab6bfa836
Removing intermediate container 4b0e5751281b
Step 4/6 : ADD ServiceMonitor.exe /
ADD failed: GetFileAttributesEx \\?\C:\WINDOWS\TEMP\docker-builder455754487\ServiceMonitor.exe: The system cannot find the file specified.

microsoft/aspnet到底是什么?4.6? 4.7? 我需要4.6这是最新的,所以可能是4.7。如果愿意,您可以使用标记4.6.2:从microsoft/aspnet:4.6.2您的docker文件是错误的,因为它依赖于您没有的生成文件夹中的
ServiceMonitor.exe'
。从一开始就自己制作整个
DockerFile
,不要依赖样本等,它们很快就会过时
FROM microsoft/aspnet
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

EXPOSE 80

RUN Remove-WebSite -Name 'Default Web Site'  
RUN New-Website -Name 'YourSiteName' -Port 80 -PhysicalPath 'C:\YourFolderName' -ApplicationPool '.NET v4.5'

ADD "LocalFolderPath" /YourFolderName