Windows Azure : How to define Virtual Directories in Service Definition (CSDEF) for your site?

In Windows Azure SDK 1.3 you have ability to setup multiple sites
within your full IIS role as well as Virtual directories.

When you are developing your application and needed to setup
Virtual Directories, here I will explain how you can configure VirtualDirectory
for specified Site in ServiceDefinition.csdef file.

So if you have your VS2010 Solution is located at:  


And your Cloud Project is:


In that case the Service Definition (CSDEF) should be constructed
for Virtual Directories as below

<ServiceDefinition name="Service_Name" xmlns="">
<WebRole name=" Services.WebRole_Name">
<Site name="Web" physicalDirectory="..\..\1.0.0\PHYSICAL_DIRECTORY">
<VirtualDirectory name="VersionDir" physicalDirectory="..\..\1.0.0">
<VirtualApplication name="AppDir" physicalDirectory="." />
 <Binding name="Endpoint1" endpointName="Endpoint1" />
         <InputEndpoint name="Endpoint1" protocol="http" port="80" />
<Import moduleName="Diagnostics" />


You need to control TWO important things:

1. Please be sure to keep the total path size under 260
characters otherwise you will get another error.

2. The directory name must be
under 248 characters which could also cause another error.



Comments (1)

  1. Jag says:

    What if my website has multiple virtual directories, and I only want to release one of these virtual directories?

    for example, my root website has a login site. The root then has multiple virtual directories containing mini-websites. These mini-websites are developed and released separately. Is it possible to release these mini-websites without releasing the whole thing?

Skip to main content