ASP.Net Core Angular项目使用Docker进行容器化部署(1)-- 发布文件容器化

本文详细介绍了如何在Windows环境下,利用Docker Desktop、Visual Studio 2019和Angular CLI 9.1.3,将ASP.Net Core Angular项目进行容器化部署。步骤包括安装Docker、项目发布、创建Dockerfile、修改Docker配置文件、生成及查看镜像,最后通过命令运行容器并映射端口以实现应用访问。
摘要由CSDN通过智能技术生成

ASP.Net Core Angular项目使用Docker进行容器化部署(1)-- 发布文件容器化

一、介绍

本文将介绍如何将ASP.Net Core Angular项目通过Docker进行容器化部署,主要的方式是将发布的文件进行容器化部署

二、环境

  • Window 10
  • Visual Studio 2019
  • Angular cli 9.1.3
  • Docker

三、部署

1、安装

下载Docker desktop并安装

1、发布

将项目发布到项目的/bin/Release/netcoreapp3.1/publish目录,具体操作可参考ASP.Net Core程序发布一文

2、创建Dockerfile

在项目文件上右键,选择【添加】–【Docker支持…】
Docker支持
在弹出的Docker文件选项选择框中选择【Linux】选项,然后点击【确定】即可

It's only been a year since I wrote ASP.NET Core and Angular 2, but it definitely feels a lot more, at least from a web developer's perspective. Modern web technologies are still improving at lightning-fast speed, with an increasing, perceptible, and measurable interest being in the client-side aspects of the game. Angular, React, and VueJS collected no less than 150,000 StackOverflow questions in the latest 18 months, which is more than 250 per day--and the trend is still growing. That's to be expected, since most of the major conceptual changes that occurred between 2015 and 2017 have been hitting the clients way more than the servers; we switched from a reactive approach of doing stuff--that led us to build responsive, resilient, elastic, and message-driven Single-Page Apps (SPAs)--to a progressive way of seeing things--which materialized into Progressive Web Apps (PWAs). The change of perspective is slight, yet prominent; far from being a different paradigm, what we've seen was nothing less than the natural and inevitable evolution of the same original concepts. Compared to the SPA revolution that took place in 2015-2016, the rise of Progressive Web Apps is not a game-breaking event; we can say that PWAs inherit all the major concepts that were already part of the Reactive Manifesto and bring them further on with brand new features--such as Service Workers--that would not have been possible without some relevant client-side accomplishments such as HTML5, modern browsers, and ECMAScript 6. PWAs are a much expected improvement in the present that also emphasizes its increasing distance from the past. At the same time, PWAs are not meant to be the future, not because they won't become a standard--they definitely will--but because they will also improve and, eventually, collapse into something else. This is how the client side of the moon always worked and--hopefully--always will.
要将ASP.NET Core Angular项目部署到IIS上,并且遇到"non-js module files deprecated"的问题。 首先,我们需要确保我们正在使用的是最新版本的ASP.NET CoreAngular。新版本通常会修复旧版中的已知问题。 然后,我们需要检查我们的Angular项目中是否有使用到非JS模块文件(non-js module files)。这些文件可能是早期版本中的遗留文件,因此被标记为过时(deprecated)。 要解决这个问题,我们可以按照以下步骤进行操作: 1. 检查Angular项目中的Angular.json配置文件。在该文件中,我们需要确保所有的非JS模块文件都被正确地排除在构建过程之外。这可以通过在 "build" 部分中的 "assets" 属性中排除这些文件来实现。 2. 确保我们使用的是正确的构建命令。在命令行或脚本中,我们应该使用 "ng build" 命令来构建我们的Angular项目,并确保在构建过程中自动排除非JS模块文件。例如,我们可以使用以下命令构建项目: ``` ng build --prod ``` 3. 删除任何已经存在的非JS模块文件,以避免将其错误地部署到服务器上。通常,这些文件可以在Angular项目的 "src" 目录中找到,并且可能以 ".css", ".html" 或 ".json" 结尾。 4. 部署我们的ASP.NET Core Angular项目到IIS。可以通过将项目文件复制到IIS网站目录中或使用自动工具(例如Web Deploy)进行部署来实现。确保将ASP.NET Core应用程序部署为网站的子目录,以便正确配置IIS的应用程序池。 通过按照上述步骤进行操作,我们应该能够成功地将ASP.NET Core Angular项目部署到IIS上并解决"non-js module files deprecated"的问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值