Skip to main content

Some deployment methods of a web application on Windows Azure

With the new version of Windows Azure we can publish web-sites on Windows Azure more easily. This new features can be used with Visual Studio 2010 also, not only with the new Visual Studio 2012 (current version is RC).
The classic deploy, using a deploy package or from the Azure project from Visual Studio remained unchanged. The new features help us a lot when we want to publish a new version (update) of web-site without recreated the web-role. In the old version of Windows Azure, this could be done, but there were a lot of configuration that need to be done on the solution.
Let see how we can publish a web-site very easily using the new features. I assume that you already have a Windows Azure account and a Windows Azure Deployment Project added to your current solution.
When you first time want to publish the web application you will need to configure the account credentials. The main different from the old version is the option to download the credentials information from Windows Azure Portal. At this first step you will find a URL that will redirect you to the page where from credentials can be downloaded. This information will be saved on your computer. Use the “Import” button to import all this information. After you make this configuration you are ready to deploy the application. No more copy/paste the subscription ID, user, and password and so on. This is one of the think that I hated more, the 1st time configuration of the Windows Azure Deploy Project.
Don’t forget to have a storage account configured also. It will be used to the deployment process. After the deploy ends, the package is automatically removed from the storage. I recommend having two instances because when an upgrade is made, the web application will be down. But with the new upgrade mechanism deploy can be made only in few seconds.
If you want, the wizard gives us the possibility to select a specific storage account or to have a custom label for the given deployment and so on. At this step, if you want to allow upgrades of your application, you need to select the “Enable deployment upgrade”.
Another very fast deployment process is the web deploys functionality. There are some very important things that you should know about this type of publish:
  • A web deploy can be made only to the web role. You will not be able to upgrade a worker role for instance. Because this process use a feature that can be found on the IIS
  • Use this deployment method when you are on the development process or testing. But never on a production environment as a deployment step. Because if the web role instances crash, the image that will be used to redeploy the package will be original one, not the one from the upgrade. This feature can be used for hot fixes in production if we cannot make a normal deploy, but we need to be very careful with it.
  • The remote desktop connection need to be activated on the web role.
  • This deployment can be done only when we have only one web role per web application. If for example we have 10 web role for a given application, that this deploy method cannot be used. Because Visual Studio should connect to each web role and make the upgrade.
  • Only the file that was changed is uploaded to the web role. For example if we have 10 html file, and only one file is changed, than that file will be the only file that is uploaded to the worker role.
After we configure the web deploy mechanism the only thing that you need to do is to right click on the web project and click “Publish”. If is the first type when you do this you will need to select the username, password and also the publish profile. You could have project with more than one publish profile (eq.: production, testing, development).
Let see how we can configure the web deploy. First of all you need to have the Remote Desktop connection activated. The same thing is required to make an upgrade. After that when you deploy your web role you need to select “Enable Web Deploy”. After that, when you will make a deploy, the web roles will have this options activated and you will be able to make the publish in only few seconds.
The web publish process goes on HTTP by default. If you want to have a secure connection (using HTTPS) you will need use a certificate from Windows Azure portal. I recommend creating on your machine a certificate for this purpose and uploaded it to the portal.
The default way to add this certificate is too remote connects to each machine and add the corticated to the IIS. Another solution is to add the certificate to the Azure project. To do this you will need to add the following lines of code to your “ServiceDefinition.csdef” from Azure project:
<Certificates>
<Certificate name="myProject" storeLocation="CurrentUser" storeName="My" />
</Certificates>
Next, in the *.cscfg file you will need a node for your defined certificate under the web role node with the thumbprint of your certificate:
<Certificates>
<Certificate name="myProject" thumbprint="17485124E04D8E64B1044F5BB43FEEDF431B5B32" thumbprintAlgorithm="sha1" />
...
</Certificates>
This certificate needs to be installed on your machine. The store name represents the location where certificate can be found. This configuration can be made from the UI, if you open your web role under the Roles directory from the Azure project and select the “Certificates” tab.
You can also make a web deploy using FTP. When you want to make a publish, you need to select the FTP publish method instated of web deploy.
There are a lot of methods to publish a web application to the cloud. You need to choose the best one for you and for your project.

Comments

  1. Your style is unique in comparison to other
    folks I have read stuff from. Many thanks for posting when you have the
    opportunity, Guess I'll just bookmark this blog.
    Feel free to visit my web blog ... free sites

    ReplyDelete

Post a Comment

Popular posts from this blog

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…