Avkash Chauhan's Blog

Windows Azure, Windows 8, Cloud Computing, Big Data and Hadoop: All together at one place.. One problem, One solution at One time...

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

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

  • Comments 1

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:  

         C:\App\Enterprise\Release\Service_Name\1.0.0

And your Cloud Project is:

         C:\App\Enterprise\Release\Service_Name\1.0.0\PHYSICAL_DIRECTORY


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


<ServiceDefinition name="Service_Name" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name=" Services.WebRole_Name">
      <Sites>
       <Site name="Web" physicalDirectory="..\..\1.0.0\PHYSICAL_DIRECTORY">
         <VirtualDirectory name="VersionDir" physicalDirectory="..\..\1.0.0">
           <VirtualApplication name="AppDir" physicalDirectory="." />
         </VirtualDirectory>
         <Bindings>
           <Binding name="Endpoint1" endpointName="Endpoint1" />
         </Bindings>
        </Site>
      </Sites>
      <Endpoints>
         <InputEndpoint name="Endpoint1" protocol="http" port="80" />
      </Endpoints>
      <Imports>
           <Import moduleName="Diagnostics" />
      </Imports>
   </WebRole>
</ServiceDefinition>

 

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.


 

 

Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
  • 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?

Page 1 of 1 (1 items)