Publishing Windows Azure Solutions from VS2012


I will publish the MVC 4 solution which we created in the previous post to the Windows Azure. You should have a Windows Azure account from http://www.windowsazure.com. Once you have got your account after entering the payment information and selecting your subscription you can see the Windows Azure portal as below.

1

To deploy our application to Windows Azure we would require the following steps.

1- Create a new Hosted Service.
2- Create a new Storage Storage Account.
3- Create and configuring management Certificates.
4- Pre-publishing steps.
5- Publishing the solution from Visual Studio 2012.
6- Changing runtime configurations after deployment (Not mandatory for publishing)

1- Create a new Hosted Service

To deploy our application containing a Web and a Worker role we would need Storage Service and Hosted Service. First we would create a Hosted Service which is to host our Web and Worker role services. Click on New Hosted Service and the below popup would open. In the dialog you can choose a subscription and enter the name of your Hosted Service. Choose a URL prefix for your service I am naming it HelloWorldAzureAbdul. For the solution I am creating and affinity group which is going to have my Hosted Service in the East Asia Data Center region.

2  3

Choose Do not deploy and click OK. You can see in the Hosted Services we have a Hosted Service called “HelloWorldAzureAbdul” which we created.

4  5

2- Create a new Storage Storage Account

To create a new storage account go to “Storage Accounts” and then on the top click “New Storage Account”. In the dialog give choose a subscription and enter the URL. I will enter the same URL helloworldazureabdul and choose the affinity group which was created in Step 1. Click OK and then you can see that the new Storage Account is created.

3

3- Create and configuring management Certificates.

To enable Visual Studio deploy the solution to my Windows Azure solutions we need to configure the management certificates so that I can enable my account to accept deployment from my machine which has the SSL certificate. In Visual Studio go to the Server Explorer (CTRL+W, L) where you can see the Windows Azure Compute and Windows Azure Storage Node which is installed by the Windows Azure SDK.

Right Click “Windows Azure Compute” and Click “Add Deployment Environment”.

6

Since I don’t have any existing deployment environment Click “Manage”. In the Authentication Settings dialog click “New” which would ask you to create a new certificate on your local machine.

7  8

Enter a friendly name of the certificate, I would name it “HelloWorldAzureAbdulCert” and then click OK. You can enter the name of these credentials I would name them “HelloWorldAzureAbdulAccount”. In the second textbox you need to enter your subscription ID which you can get from the portal.

9  15

In the above dialog click “Copy the full path” of the certificate you created. Click OK and you will be able to see the Account with the Solution Environment.

16

In the management portal go to Management Certificates and select your subscription. Then on the top click “Add Certificate”.

11

Click Browse to upload the certificate from your local PC. Since we already copied the full path of the certificate created we can just paste it and click Open.

12

Click Ok and then in the portal you will be able to see the uploaded certificate.

13  14

4- Pre-publishing steps

Before publishing the application to the cloud we need to make sure about the dependencies that are locally present on the machine but they won’t be available in the cloud. We need to check for the referenced assemblies connection strings and application configurations. If there are any third party assemblies or your local project assemblies so set the Copy Local property of the assemblies to True.

If you look at the worker and web role settings in the Windows Azure project it is having connection strings being used by diagnostics so you can uncheck the option to remove these diagnostic connection strings so that there are no dependencies.

5- Publishing from Visual Studio 2012

Now that everything is set up we can publish the solution to the cloud from VS. Right click the Windows Azure project and then click Publish. It will open the Windows Azure publish wizard in the first step Choose the subscription.

20

21

Click Next and in the Common Settings tab choose the cloud service solution, choose the staging/production environment. In the Advanced Settings tab label the deployment and select the Storage Account. Click next to finish the publishing steps and go to the summary page.

22

23

24

The deployment will start and the deployment progress can be seen in the Windows Azure Activity log window in Visual Studio.

27

After sometime you can notice in the Server Explorer that the Web and Worker role VM’s are created in the staging environment of the deployment but will be in the stopped state.

28

In the Server Explorer after some time it can be noticed that the VM’s are starting.

29

Once the deployment is completed the status will be updated to completed and the Website URL with a GUID will be created.

32

You can then go the the website URL generated and see the application. In the portal you can see that the solution is deployed.

33

34

6- Changing runtime configurations after deployment.

In the previous post we added a configuration key “Message” so that it can be changed after deployment into the cloud and re-deployment can be avoided. We can change the configuration from the portal, Select the Deployment and then click Configure in the top menu. A dialog having the configuration XML will appear in which the Message value can be changed.

36

After changing the value click OK as shown below and the changes will take effect in each instance of the web role.

37

38

You can refresh the browser where the application in the cloud was opened and see the updated message.

39

Creating my first Hello World cloud solution


I was very happy with the news that recently Windows Azure was available in my region which I was waiting for. So this would be my first cloud solution which I would deploy in the cloud. To start with I will make a simple MVC 4 application and deploy in the cloud using VS 2012.

The Windows Azure SDK for .NET can be downloaded from here for VS2012/VS2010. After installing the SDK you would get the Windows Azure tools and Emulator to develop and test cloud solutions locally. After installing the SDK you can see the cloud template under C# as shown below. You can see the cloud service by selecting framework 4.0 and then selecting “Windows Azure Cloud Service”.

1   2

In the dialog box below you can select the different roles that are required for the cloud solution. In our scenario since we are making a simple MVC 4 application so a MVC 4 web role would be enough but to do more with the solution in the future I am adding a worker role. A web role is the front end of the azure service which can be assumed that it will be on a web server (IIS) in the cloud whereas a worker role can be assumed as a Windows Service which can be used for background processing.

3   4

The web and worker roles will be renamed from the default and click OK. After that the template for MVC 4 application will appear and we will choose the internet application.

5

As you can see in the solution there are three more projects along with the MVC 4 project. One is the Unit test project for the MVC. In the MVC project you can see that most of the files are the same but with one more additional file WebRole.cs. If you open this file you can see the entry point. This is the entry point which is going to start everything before the web application starts executing.

If you go to the worker project and open the WorkerRole.cs you can see the Run method and the OnStart method. The Run method will have the implementation of your code in which you can fire some events like call WCF service, monitor for storage etc.

The third Windows Azure project you can see a Web Role and a Worker Role configuration file. If you open the HelloWorldMvcWebRole file you can see the below configurations. In this configuration files we can specify how many web role instances we want in the cloud and the size of the VM. The VM size has different billing cost so we will specify the extra small VM since we don’t need much memory and processing. I will specify two instances for high availability and load balancing the web role.

In the settings tab I will add another configuration called “Message” in which I will specify a string value “Hello Windows Azure”. The advantage of this configuration is after deploying the solution in the cloud we can change the value and it would reflect in the application at runtime. Otherwise without configuration these changes would require redeployment in the cloud. So keeping these kind of settings in the configuration is an important decision while developing Azure solutions.

7

8

If you open the ServiceConfiguration.Cloud.csfg file you can see all the settings in the XML format which we specified above in the interface.

9

Now lets open the HelloWorldWorkerRole file and you will find the same GUI and configurations. Right now we are not doing any background processing so I will keep the instance count 1 and the VM size as Extra Small.

10

Now lets change some code in the Home Controller in the MVC Web role project as in the below screen and put a break point. We are just reading the “Message” configuration key from the Windows Azure project as shown in the code below. Lets hit F5 and run the project. Make sure that the “Compute Emulator” and the “Storage Emulator” which was installed with the SDK is started and the status is in the Running State in the task bar.

13

The output can be seen on the browser and note the URL that it is running locally on the PC with the Windows Azure Emulators.

15

You can open the Windows Azure Compute Emulator from the taskbar and see the deployment. You can see the two instances of the Web Role and one instance of the Worker Role as shown below. The Emulator runs on the local PC emulating the cloud and using the local storage. You can open the local store as shown below in the screen.

17

18

BizTalk 2010 Cookbook Released


I am very happy to announce that BizTalk 2010 Cookbook written by a great MVP Steef Jan is released.

He has done a marvelous job writing this book, the contents of the book can be viewed at Packt Website.

The book is mainly for Developers and Administrators who can gain their knowledge in Development, Maintaining, Monitoring & Deployment of BizTalk Solutions. The book has step by step implementations (recipe) of BizTalk Solutions which follows industry best practices & patterns.

I had the honor to be one of the official technical reviewer of the book along with Randal van Splunteren, Sandro Pereira & Rene Brauwers

I have enjoyed reviewing the book specially the recipes related to Monitoring and deployment, of which most of the developers and administrators are unaware.

Congratulations Steef, it has been an outstanding effort from you authoring the book so well.

BizTalk2010Cookbook

BizTalk Server MVP 2012


So another year starts with a great news from Microsoft. I would like to thank Microsoft, my fellow MVPs, my MVP Lead-Ruari Plint, community members and my wife. Thank you all for your support without you people this would not be possible.

Hope this year brings the same success to me as the previous years. Happy New Year to everyone.

MVP_Horizontal_FullColor

I used to wait for the news on the new year but this time I was really busy and my family reminded me of the award renewal date. So today I just checked my inbox for the email from Microsoft.

BizTalk 2010 Web Console


I am very glad to announce the BizTalk Web Console version which is published on codeplex (http://btswebconsole.codeplex.com/) for public now.

The demand for the web version of the BizTalk Administration console has been around by the community so I decided to develop it.

Project Description
BizTalk 2010 Web Console allows administrators/operators to perform operations below from the browser.

  • Stop/Start/Restart Host Instances
  • View Status of Service Instances by applying queries to the group.
  • Stop/Start/Unenlist Orchestrations, Send Ports and Send Port Group
  • Stop/Start Receive Locations
    It works on Single/Multi-Server environment and has been tested on BizTalk Server 2009 and BizTalk Server 2010.

Demo

 

Passed BizTalk 2010 Exam (70-595)


Yesterday I passed BizTalk 2010 Exam – 70-595 (TS: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2010) which was released on 30 March 2011. The questions were interesting and most of the questions were quite easy and I was able to answer them from my experience. Apart from my professional projects I have learnt a lot from participating in the MSDN forums that is why the exam questions were quite familiar.

Because I read the NDA I can’t tell the level of simplicity Smile Well I prepared a lot for EDI and RFID and I was a bit better than before. For the rest of the sections I didn’t had to prepare as I could answer them easily. In my opinion anyone working for 3+ years can pass the exam.

I have passed BizTalk 2006 and BizTalk 2006 R2 previously but they were retired on 30 June 2011.

Passed BizTalk 2006 R2 exam (70-241)


I know I am late (probably will be the last) in taking BizTalk 2006 R2 (70-241) exam (Released in October 2009) and will be now retired on June 30 2011 with BizTalk 2006 (70-235) which I passed in June 2008. So I am heads up with BizTalk 2010 (70-595) exam which just released on March 30 2011 and will be taking it next week. Hope to pass that too!

So my passion for BizTalk compelled me to register for BizTalk 2006 R2 exam with BizTalk 2010. Even though it is retiring it was worth taking BizTalk R2 because no one is perfect and I was able to discover my weakness in BizTalk extended capabilities (RFID, AS2, EDI). So when preparing for BizTalk 2010 I am focusing on EDI and RFID which also helped me in BizTalk 2006 R2 exam.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: