Installing requirements using Azure startup tasks

Windows Azure deploys your azure web or worker role in the cloud, on a machine with Windows Server 2008 and .NET 4 pre-installed. But what if you need an additional requirement? What if you need to install some performance counter, or if you need some other piece of software like the media encoder? Then you can use a startup task to get the job done. In this blog post you will create a simple web role using ASP.NET MVC 3, then add a startup task to ensure MVC 3 is also installed on the Azure instance. For this walkthrough you’ll need Visual Studio 2010 and ASP.NET MVC 3. You’ll also need the standalone MVC 3 installer, which you can find here.

Step 1: Create the Azure solution.

Start by creating a new Cloud project, call it UsingStartupTasks.

image

Click Ok. Don’t add any role just yet, so click Ok in the next screen. MVC 3 is not available from the “New Windows Azure project” dialog, so we’ll need to use another way to get an ASP.NET project in Azure…

image

Now add a new ASP.NET MVC 3 project, calling it HelloMVC3.

image

Select the Internet Application template, leave the rest to its defaults, then press Ok.

Right-click the Roles folder beneath your cloud project and select Add->Web Role Project in Solution

image

Select the HelloMVC3 project in the next screen and hit Ok.

Adding the Startup task

Add a new folder StartupTasks to your MVC project and add the MVC installer AspNetMVC3Setup.exe to it. Open notepad.exe (don’t add the following file using Visual Studio because it will add a Byte Order Mark and the Azure runtime doesn’t like that) and create a new batch file called installmvc.cmd in the StartupTasks folder. To add it to the Visual Studio project first click on the Show All Files button in the solution explorer, and then right-click the installmvc.cmd file and select Include In Project. Do the same for the AspNetMVC3Setup.exe installer.

image

We’ll use this batch file to execute the installer as follows: enter following in installmvc.cmd:

%~dp0AspNetMVC3Setup.exe /q /log %~dp0mvc3_install.htm
exit /b 0

 

The %~dp0 actually returns the install folder for your azure project, so the first line will run the standalone MVC3 installer, this will write any install problems to a log file called mvc3_install.htm.

The %~dp0 is used to get the directory containing the startup tasks (an azure server local copy of the StartupTasks folder). The first statement will do a silent (quiet) install of MVC3, and the next line will return a success error code.

Make sure both files have a build action of “none” and Copy to Output Directory set to “Copy Always”.

image

Editing the Service definition file

Finally you need to open the ServiceDefinition.csdef file and add the task to it:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="UsingStartupTasks" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="HelloMVC3">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      …
    </Imports>
    <Startup>
      <Task commandLine="StartupTasks\installmvc.cmd" 
            executionContext="elevated"
            taskType="simple"
      />
    </Startup>
  </WebRole>
</ServiceDefinition>

 

In this <Startup> element you can add any number of Task elements. Each represents a commandLine that will be executed on the installing instance prior to installing your azure project. You also get a couple of options, first you can specify the executionContext: this can be elevated or limited. Elevated gives you administrator-like privileges and is ideal for installers (which normally only work with admin privileges). Limited gives you “normal user” privileges. You can also choose the taskType. This is how the task will be executed. You get three options: simple, background or foreground. Simple means that the installer will wait for this task to complete before continuing with the next task (or the actual installation of your azure role). Background and foreground means the same thing like in threading. Background will not block the installer from continuing with the next task, and these will run in parallel. So to get MVC3 installed we need to run elevated, and we don’t want installation to continue before MVC3 has been installed, so we choose simple as the task type…

Deploying to Azure

Right-click on the Cloud project and select Publish… The Deploy Windows Azure project dialog opens:

image

Select your credentials, environment and storage account. You may need to do some setup for this to work…

Optionally you can configure remote desktop connections in case something went wrong, this will make it easier to see if MVC 3 was indeed installed.

Click on Ok and wait…

Deployment in Visual Studio should start:

image

Wait some more till complete (because the startup tasks are executing this will take a long time):

image

Click on the Url. You should now see the MVC 3 screen!

In my next blog post I will show you how to turn this startup task into an azure startup plugin, which will make it easier to re-use this startup task.


Comments (2) -

December 6. 2011 07:35 PM

ugg boots outlet

Good idea, I agree with your thoughts! Great features: I really like the Spanish proverb that claims, "A wealthy child usually sits inside a poor mother's lap.(<p><em><a title="cheap ugg boots" href="www.genuineuboots-australia.com/">cheap ugg boots</a></em>
<p><em><a title="ugg boots sale" href="www.genuineuboots-australia.com/">ugg boots sale</a></em>
<p><em><a title="ugg boots" href="www.genuineuboots-australia.com/">ugg boots</a></em>
<p><em><a title="uggs outlet" href="www.outletuggsaustraliasale.org/">uggs outlet</a></em>
<p><em><a title="uggs" href="www.outletuggsaustraliasale.org/.../em>;
<p><em><a title="cheap uggs" href="http://www.outletuggsaustraliasale.org/cheap uggs</a></em>)I wish I could remain at home with my young ones and work at home so I can be with my kids and generate a living,(<em><a title="ugg boots clearance" href="www.discount-uggbootsclearance.org/">ugg boots clearance</a></em>,<p>
<em><a title="ugg boots outlet" href="www.discount-uggboots-outlet.com/">ugg boots outlet</a></em>


) but I don't know in which to begin. Many women get up early, get the youngsters dressed, drop them off at day care, drive in rush-hour targeted visitors, and arrive at perform exhausted, considering, "There needs to be an improved way.Selecting to do the job in the home might be a tricky financial<p>

<em><a title="ugg boots" href="http://www.uggboots-outletonline.net/">ugg boots</a></em><p>
<em><a title="uggs clearance" href="http://www.uggs-salesclearance.com/">uggs clearance</a></em><p>
<em><a title="ugg boots clearance" href="http://www.uggs-salesclearance.com/">ugg boots clearance</a></em>

ugg boots outlet

March 12. 2012 07:25 PM

dailina

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19190"></HEAD>
<BODY>
<P>&nbsp;Purchasing burberry outlet bags is like a desire for the majority of
us. For some it remains to be considered a desire to non-public among the bags
from huge traders and some spend heavily for them to acquire in a location to
stroll with their heads higher all through the companionship.Online buying for
<a href="http://www.famerbook.com/burberry-c-5.html/"; title="burberry watches"><strong>burberry watches</strong></a>
bags is among probably the most effective methods of retailing. We
obtain a choice of choices all through the style burberry bags replication. Even
So, there are lots of Net scams that cheat unsuspecting potential customers of
the hard-earned money. should you adhere to some basic rules when getting
handbags, there are much less odds of acquiring fooled.</P>
<P>&nbsp; I always dread the <a href="http://www.famerbook.com/bu1360-p-137.html/"; title="bu1360 burberry"><strong>bu1360 burberry</strong></a>
show at London Fashion Week. First,
because I know that Christopher Bailey’s beautiful ready-to-wear, and his
outerwear in particular (THOSE COATS.), will threaten to drain my bank account
all over again with one swift poke the the pleasure center in my brain, which
apparently really likes wool. Second, because I know I’m probably going to have
to write something unkind about the handbags. Both fortunately and
unfortunately, Burberry Prorsum Fall 2012 did not break from that pattern.</P>
<P>&nbsp; I always dread the Burberry show at London Fashion Week. First,
because I know that Christopher Bailey’s beautiful ready-to-wear, and his
outerwear in particular (THOSE COATS.), will threaten to drain my bank account
all over again with one swift poke the the pleasure center in my brain, which
apparently really likes wool. Second, because I know I’m probably going to have
to write something unkind about the handbags. Both fortunately and
unfortunately,<a href="http://www.famerbook.com/bu1360-p-137.html/"; title="bu1360 burberry"><strong>bu1360 burberry</strong></a>
Prorsum Fall 2012 did not break from that
pattern.</P></BODY></HTML>

dailina

March 12. 2012 07:32 PM

dailina

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19190"></HEAD>
<BODY>
<P>&nbsp;The documentation is pretty basic.&nbsp; There is a very brief quick
start guide included that will help users who have never used a digital camera
before.&nbsp; The guide explains how to load batteries, a memory card, and snap
basic photos/videos – all this info is stretched to fill a two sided
poster-sized sheet.&nbsp; The basic reference guide provides about 35 pages of
info about most features of the camera, though it is quite bulky because<a href="www.edificesale.com/efe503d1av-p-69.html"; title="casio edifice 503"><strong>casio edifice 503</strong></a>

includes support for 21 languages.&nbsp; For more in-depth information about the
camera a manual is included on the CD along with Adobe Reader and a Youtube
uploader for videos from the camera.&nbsp; </P>
<P>&nbsp;&nbsp; I was a little disappointed that Casio did not include any more
exciting software to make use of the videos, or any other software
really.According to reports, <a href="http://www.edificesale.com/"; title="casio watches"><strong>casio watches</strong></a>
series GB-6900 solid type watch
to<BR>the user can provide a very powerful features, it is that users
can<BR>directly from your G-Shock watch on the surface of updating mobile
phone<BR>reminders, such as intelligent mobile phone exists on new missed
call,<BR>email, or a short message content, watch will accordingly the tip,
which<BR>is convenient for users.The first G-Shock was the DW-5000C-1A designed
by an engineer working for <a href="www.edificesale.com/ef550rbsp1av-p-1.html"; title="casio edifice 550rbsp"><strong>casio edifice 550rbsp</strong></a>
named Kikuo Ibe. It was released in April 1983.
For the next few years Casio released a handful of new models each year.</P>
<P>&nbsp;&nbsp; There are all types of Casio watches available, not forgetting
that Casio has also been there from the beginning of the time keeping to now the
era of new time keeping and designs. The list of watches from the beginning to
now is endless; The Casio F91W is an inexpensive quartz digital watch, it was
introduced in 1991. The Casio DW-5600E is a model of digital watch; Casio
introduced this model in 1996. It has 200m water resistance, one alarm, a
countdown timer and a stopwatch. These features trigger an audible alarm.
G-Shock is a brand of watches manufactured by Casio, known for its resistance to
shocks (e.g. hard knocks and strong vibrations). </P>
<P>&nbsp;&nbsp; </P></BODY></HTML>

dailina

March 20. 2012 05:32 PM

tiffany outlet,tiffany silver,tiffany necklace




of nished job and getting back into the grove Once you get used to using the system it will <a href="http://www.jewelryoutletsaleonline.com"; title="tiffany ring,tiffany silver,tiffany 1873 rings"><b>tiffany jewellery wholesale</b></a> ,<a href="http://www.jewelryoutletsaleonline.com"; title="engagement rings tiffany,tiffany necklace,tiffany earrings"><b>tiffany & co</b></a> ,<a href="http://www.jewelryoutletsaleonline.com"; title="tiffany earrings,wholesale tiffany jewelry,tiffany bracelet"><b>tiffany outlet</b></a>,<a href="http://www.jerseysoutletsale.com"; title="jerseys cheap,nfl jerseys on sale,where to buy nfl jerseys"><b>nfl jersey</b></a>,<a href="http://www.jerseysoutletsale.com"; title="football jerseys,nfl jerseys wholesale,nba jerseys"><b>nfl jerseys cheap</b></a>,<a href="http://www.jerseysoutletsale.com"; title="wholesale jerseys,nfl football jerseys for women,nhl jerseys for sale"><b>nba jerseys wholesale</b></a>,<a href="http://www.2012christianlouboutinonline.com"; title="shoes christian louboutin,christian louboutin pump,christian louboutin on sale"><b></b>christian louboutin shoes</a> ,<a href="http://www.2012christianlouboutinonline.com"; title="christian louboutin wedding shoes,christian louboutin shoe,christian louboutin discount"><b>christian louboutins shoes men </b></a> ,<a href="http://www.2012christianlouboutinonline.com"; title="christian louboutin sale,cheap christian louboutins,christian louboutin boots"><b>christian louboutin heels</b></a>,<a href="http://www.swarovskioutletsaleonline.com"; title="swarovski wholesale,swarovski crystals,crystallized swarovski"><b>swarovski outlet</b></a> ,<a href="...outletsaleonline.com"title="swarovski outlet,swarovski necklace,swarovski shop"><b>swarovski elements</b></a> ,<a href="http://www.swarovskioutletsaleonline.com"; title="swarovski stores,swarovski jewelry,swarowski"><b>swarovski ring</b></a>,<a href="http://www.wholesaletiffanyonline.com"; title="tiffany & co outlet,tiffany& co,tiffany silver"><b>tiffany and co</b></a> ,<a href="http://www.wholesaletiffanyonline.com"; title="tiffany 1873 rings,engagement rings tiffany,tiffany necklace"><b>tiffany outlet</b></a> ,<a href="http://www.wholesaletiffanyonline.com"; title="wholesale tiffany jewelry,tiffany earrings,tiffany bracelet"><b>tiffany ring</b></a>
come very naturally and you will feel very calm and confihen. the products you sell online, for

tiffany outlet,tiffany silver,tiffany necklace

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Download the U2U brochure

Download Brochure

Receive the U2U Newsletter. Submit your email address:
 
 


 


Search

rss  RSS

Archive