我们可以在windows容器上部署一个asp.net mvc 4应用程序到docker吗? [英] Can we deploy an asp.net mvc 4 app to docker with windows container?

查看:159
本文介绍了我们可以在windows容器上部署一个asp.net mvc 4应用程序到docker吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近看到的所有演示都是面向Asp.net的核心(我不知道它的稳定性和功能性,因为它不包含所有的asp.net功能),因为Windows Server 2016支持容器(和docker),我们应该能够部署一个asp.net mvc 4.0应用程序吗?

解决方案

是的。



您可以使用 microsoft / windowsservercore microsoft / iis 作为基础映像,安装完整的ASP.NET并在Windows上的容器中运行旧版.NET应用程序。您现在可以使用Windows 10和Server 2016 TP5来实现,但RTM(预计下周在Ignite)应该更加稳定。



我已经通过Dockerizing旧的 Nerd Dinner showcase应用程序。你最终得到一个3GB的Docker图像,所以你不会得到一个小而高效的图像的所有好处 - 但是你可以在一个容器里运行你的应用程序,这就是打破巨石的一个出发点。



对于引用,这是编译ASP.NET应用程序的Dockerfile如下所示:

  FROM microsoft / iis 

RUN [powershell.exe,Install-WindowsFeature NET-Framework-45-ASPNET]
RUN [powershell.exe,安装-WindowsFeature Web-Asp-Net45]

添加网络应用程序/ c:\\web-app

EXPOSE 8081

运行PowerShell新网站-Name'web-app'-Port 8081 -PhysicalPath'c:\web-app'-ApplicationPool'.NET v4.5'

ENTRYPOINT powershell


All the demo I saw lately are oriented Asp.net core (I am not sure how it's stable and functional, as it didn't contain all asp.net features), as Windows server 2016 support containers (and docker), should we be able to deploy an asp.net mvc 4.0 app ?

解决方案

Yes.

You can use microsoft/windowsservercore or microsoft/iis as a base image, install full ASP.NET and run your 'legacy' .NET apps in containers on Windows. You can do it now with Windows 10 and Server 2016 TP5, but the RTM (expected next week at Ignite) should be more stable.

I've shown this by Dockerizing the old Nerd Dinner showcase app. You end up with a Docker image that's 3GB so you won't get all the benefits of having a small, efficient image - but you can run your app in a container, and that's a starting point for breaking down monoliths.

For reference, this is what the Dockerfile for a compiled ASP.NET app looks like:

FROM microsoft/iis

RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]

ADD web-app/ c:\\web-app

EXPOSE 8081

RUN powershell New-Website -Name 'web-app' -Port 8081 -PhysicalPath 'c:\web-app' -ApplicationPool '.NET v4.5'

ENTRYPOINT powershell

这篇关于我们可以在windows容器上部署一个asp.net mvc 4应用程序到docker吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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