This document discusses migrating an existing .NET application that uses custom fonts and third-party dependencies to Azure App Service for Windows Containers. It provides instructions on modifying the application's Dockerfile to copy required files like fonts and MSIs into the container image. It also describes enabling features like .NET WCF in the container by specifying them in the Dockerfile. The document outlines using CI/CD pipelines to build the container image, deploy it to an Azure Container Registry, and then deploy the image to an Azure App Service.
32. ā¢ The sample project contains a simple ASP.NET application that uses a custom font
that is installed into the Windows font library.
ā¢ It's not necessary to install fonts, but it's an example of an app that is integrated
with the underlying OS.
ā¢ To migrate such an app to App Service, you either rearchitect your code to
remove the integration, or migrate it as-is in a custom Windows container.
33. Install the Font : In Windows Explorer, navigate to custom-font-win-container-
master/CustomFontSample, right-click FrederickatheGreat-Regular.ttf, and
select Install.
34. Ctrl + F5 to run application without
debugging.
43. Create a Web App for Containerā¦and use
your dockerized imageā¦.
44.
45. ā¢ In many cases, your existing .NET applications are not based just on your .NET
Code solution and the .NET Framework libraries but also based on additional
artifacts from Windows that have to be enabled (such as IIS, .NET WCF HTTP
Activation, Server roles, etc.) and even additional components from third parties
that you need to install in windows through .MSI setups.
46. ā¢ In order to install an MSI within a Windows Container you just need to copy in the
.msi file and run msiexec to install it.
47. There are just three lines of Dockerfile instructions:
ā¢ FROM specifies the base image to use, in this case a specific version of the ASP.NET image using
Windows Server Core.
ā¢ COPY copies the existing MSI from the local machine into the Docker image
ā¢ RUN installs the MSI using msiexec, with the qn switch to install silently, and passing a value to
the custom RELEASENAME variable that the MSI uses.
48. ā¢ That .msi setup could install whatever dependency you might need for your
application, like the .DLLS of a PDF creator library (or any other comparable case)
that you might need to use from your ASP.NET application.
49. Enabling Windows features in Docker images
ā¢ In order to enable Windows features or artifacts (like .NET WCF HTTP Activation,
IIS configuration, etc.) in a Windows Container, you need to specify those
dependencies in your dockerfile so they will be installed when the container is
deployed.
51. ā¢ The important line in that dockerfile is the line with the RUN command that
specifies to add certain Windows Feature, in this case, .NET WCF HTTP Activation.
Note that not all the Windows features can be activated in Windows Containers
since some of them are not supported, like MSMQ or other cases.
53. Navigate to the build options under Pipeline tab. Select Build definition and select
the Edit option.
54. Add tasks to the Agent Job and in the Run Service, Build Service and Push Service
task, authorize the Azure Subscription and update Azure Container Registry.
55.
56.
57.
58. Navigate to the Release section under the Pipeline tab. Select the release definition,
Click Edit Pipeline option and then click on the Tasks section
59.
60.
61. Under the Execute Azure SQL:DacpacTask section, select the Azure Subscription
from the dropdown.
Execute Azure SQL:DacpacTask: This task will deploy the dacpac to the mhcdb
database so that the schema and data is configured for the backend
62. Azure App Service Deploy will pull the appropriate docker image corresponding to
the Build from repository specified, and then deploys the image to the Linux App
Service
63. Click on Variables section, update the ACR details and the SQLServer details with the details notel
earlier while configuration of the environment and click on the Save button.
64. Initiate the CI Build and Deployment through code commit.
Click on Files section under the Repos tab and navigate to the Index.cshtml file for
editing.
66. Click on Builds tab and subsequently select the build definition and again click on
ellipsis to view the build in progress.
67.
68. The Build will generate and push the docker image of the web application to the
Azure Container Registry. Once the build is completed, the build summary will be
displayed.
69. Navigate to the Azure portal and provide the given information.
70. Navigate to the Azure Container Portal and then select the Repositories option to
view the generated docker images.
71. Navigate to the Release section under Pipeline tab, and double-click on the latest
release displayed on the Page. Click on Logs to view the details of the release in
progress.
72.
73. The release will deploy the docker image to the App Service based on the BuildID
tagged with the docker image. Once the release is completed, the release Logs will
be displayed.
74. Navigate back to Azure portal and click on the overview section of App Service. Click
on the link displayed under the URL field to browse the application and view the
changes.