在Windows Server Core Docker上安装.NET Framework 3.5 [英] Install .NET Framework 3.5 on Windows Server Core Docker

查看:378
本文介绍了在Windows Server Core Docker上安装.NET Framework 3.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在Docker容器上安装.NET Framework 3.5。我已经安装了4.5,但是需要3.5才能运行一项服务。这是我的Dockerfile:

  FROM microsoft / windowsservercore 
SHELL [ powershell]


运行Install-WindowsFeature NET-Framework-45-ASPNET; \
Install-WindowsFeature Web-Asp-Net45

RUN dism / online / enable-feature / featurename:NetFX3 / all

COPY Startup Startup
COPY服务服务



运行 C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe WCS.WindowsService。 exe


RUN mkdir Temp\日志

ENTRYPOINT C:\Startup\setupBatch.bat

COPY ContainerApi ContainerApi

运行Remove-WebSite-名称默认网站
运行新网站-名称 ContainerApi-端口80 \
-PhysicalPath'C:\ContainerApi'- ApplicationPool'.NET v4.5'

EXPOSE 80

CMD [ ping, -t, localhost]

当我尝试构建它时,它在行 RUN dism 上给了我错误p>


错误:0x800f081f



找不到源文件。

使用源选项来指定还原所需的文件的位置重新功能。有关指定源位置的详细信息,请参阅


  1. 将sxs.zip文件复制到我的容器中。我使用图像的dockerfile复制了它。

  2. 将文件解压缩到容器中的C:\sources\sxs文件夹中。

  3. 使用Install-WindowsFeature powershell命令安装功能。

      Install-WindowsFeature-名称NET-Framework-Features-源C:\sources\sxs-详细


希望这会有所帮助。我还发现以下博客对于理解按需功能很有用。
https://blogs.technet.microsoft.com/askcore/2012/05/14/windows-8-and-net-framework-3-5/


I am struggling to install .NET Framework 3.5 on docker container. I have 4.5 installed already, but need 3.5 to run one Service. Here is my Dockerfile:

FROM microsoft/windowsservercore
SHELL ["powershell"]


RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \  
    Install-WindowsFeature Web-Asp-Net45

RUN dism /online /enable-feature /featurename:NetFX3 /all

COPY Startup Startup
COPY Service Service



RUN "C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" WCS.WindowsService.exe


RUN mkdir Temp\Logs

ENTRYPOINT C:\Startup\setupBatch.bat

COPY ContainerApi ContainerApi

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

EXPOSE 80

CMD ["ping", "-t", "localhost"]  

When I try to build this, it gives me error on line RUN dism

Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

Now, even if I run dism /online /enable-feature /featurename:NetFX3 /all inside the docker (docker exec) it will still give me the same error.

Anyone with any help?

解决方案

I took the following steps to resolve this issue:

  1. Got hold of the Windows Server 2016 Core ISO file. Mounted the file on local computer.
  2. Extracted the {mount}:/sources/sxs folder into a zip file (sxs.zip). Ensure that the .NET Framework 3.5 cab file (microsoft-windows-netfx3-ondemand-package.cab) is present in the sxs folder. In my case, this was the only file present in the sxs folder.

  1. Copy the sxs.zip file to my container. I copied it using the dockerfile of the image.
  2. Unzip the file to C:\sources\sxs folder in the container.
  3. Used the Install-WindowsFeature powershell command to install the feature.

    Install-WindowsFeature -Name NET-Framework-Features -Source C:\sources\sxs -Verbose
    

Hope this helps. I also found the following blog useful in understanding the on-demand features. https://blogs.technet.microsoft.com/askcore/2012/05/14/windows-8-and-net-framework-3-5/

这篇关于在Windows Server Core Docker上安装.NET Framework 3.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆