当前位置: 移动技术网 > IT编程>开发语言>.net > Asp.net容器化

Asp.net容器化

2018年04月10日  | 移动技术网IT编程  | 我要评论

2013驾考科目一,愤怒的小鸟电脑下载,季羡林谈人生txt

注意:本文只用于探讨asp.net容器化,不建议生产环境下使用(docker 镜像太大!!!!)

 

 

安装docker

  准备一个台windwos server 2016 ,在PowerShell 里执行以下命令

Install-Module DockerProvider -Force
Install-Package Docker -ProviderName DockerProvider -Force

构建简单的网站

 

FROM microsoft/aspnet:4.7.1

COPY ./www/ /inetpub/wwwroot 

RUN  Add-WindowsFeature  Web-IP-Security; `
     powershell -NoProfile -Command Install-PackageProvider -Name NuGet -MinimumVersio  2.8.5.201 -Force;   \
     Install-Module -Name IISAdministration -Force; \
     net user web 123456 /add ;\
     net localgroup administrators web /add

RUN powershell -NoProfile -Command \
    Import-module IISAdministration ; \
    Remove-IISSite -name 'Default Web Site' -Confirm:$false ; \
    New-IISSite -Name "www.example.com" -PhysicalPath "C:\inetpub\wwwroot" 

1.通过NuGet安装 IISAdministration,这是一个IIS管理模块,可以通过本地的IIS管理容器中的IIS

2.net user web __Fm9UrD_h /add 设置用户

3.net localgroup administrators web /add 设置用户组

构建HTTPS网站

FROM microsoft/aspnet:4.7.1

RUN mkdir /inetpub/tool

COPY ./tool/ /inetpub/tool
COPY ./www/ /inetpub/wwwroot

RUN  Add-WindowsFeature  Web-IP-Security; `
     certutil -importpfx -p "111111" "C:/inetpub/tool/cert.pfx";\
     powershell -NoProfile -Command Install-PackageProvider -Name NuGet -MinimumVersio  2.8.5.201 -Force;   \
     Install-Module -Name IISAdministration -Force; \
     net user web 123456 /add ;\
     net localgroup administrators web /add

RUN powershell -NoProfile -Command \
    Import-module IISAdministration ; \
    Remove-IISSite -name 'Default Web Site' -Confirm:$false ; \
    New-IISSite -Name "www.example.com" -PhysicalPath "C:\inetpub\wwwroot" -BindingInformation "*:443:www.example.com" -CertificateThumbPrint "52C27E02D8EFB1BB488AEC13DB06E94EED18E539" -CertStoreLocation "Cert:\LocalMachine\My" -Protocol https

1.certutil -importpfx -p "密码" "C:/inetpub/tool/cert.pfx"; 添加证书

2.-CertificateThumbPrint "证书指纹" ,可以通过IIS管理器->服务器证书->查看证书->详细信息->指纹

 

 

 构建带IIS插件网站

FROM microsoft/aspnet:4.7.1

RUN mkdir /inetpub/tool

COPY ./tool/ /inetpub/tool
COPY ./www/ /inetpub/wwwroot

RUN  Add-WindowsFeature  Web-IP-Security; `
     Start-Process ' C:\inetpub\tool\rewrite_amd64.msi' '/qn' -PassThru | Wait-Process;\
     powershell -NoProfile -Command Install-PackageProvider -Name NuGet -MinimumVersio  2.8.5.201 -Force;   \
     Install-Module -Name IISAdministration -Force; \
     net user web 123456 /add ;\
     net localgroup administrators web /add

RUN powershell -NoProfile -Command \
    Import-module IISAdministration ; \
    Remove-IISSite -name 'Default Web Site' -Confirm:$false ; \
    New-IISSite -Name "www.example.com" -PhysicalPath "C:\inetpub\wwwroot"

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网