With the Windows Azure SDK 1.3 it is now possible to run web roles with Full IIS. If you are unfamiliar with Full IIS you might want to look at this blog which captures the differences between Full IIS and Hosted Web Core (HWC) the only option available with prior SDKs. Additionally you may find this blog, which drills into the impact on the storage configuration setting publisher useful too. The content from those blogs provides context for the rest of this article.
In this post we’ll discuss coding patterns for Windows Azure Drive APIs recommended for use with full IIS. All of these guidelines should work for Hosted Web Core as well. In this context we’ll also discuss one known issue with .Net 4.0. In addition we call out issues that have surfaced with SDK 1.3 and workarounds for them.
In Full IIS, the OnStart() method in the web role and Page_Load() run in different processes. Consequently a drive letter saved to a global variable in the OnStart method is unavailable to the Page_Load() method. To address this, we recommend that applications perform all drive initialization actions including setting up the cache, creating and mounting the drives in the Application_Start() method of the Global.asax file. This approach is also suitable for Hosted Web Core.
Caveats for .Net 4.0
With .Net 4.0 there is a known issue that will cause all Storage Client API calls for Blobs, Tables and Queues to fail if they are invoked in Application_Start(). The exception surfaced in this case is HttpException (0x80004005): Response is not available in this context” from Global.ApplicationStart” on .NET 4.0.
This issue will be addressed in an upcoming service pack for .Net 4.0. Until then one way to mitigate this issue, is to move all Windows Azure Blob, Table and Queue API calls to some other location like the OnStart() method or to another method in the Global.asax file depending on when the calls need to be executed. It should be noted that the OnStart() method will always execute before Application_Start().
You might also choose to stay with IIS Hosted Web Core until the issue is addressed in the next .Net 4.0 service pack. You can disable Full IIS in an existing project by commenting out the Sites element in the ServiceDefinition.csdef.
In the development environment, a drive that is mounted in one user context is not visible in another user context, and the OnStart() and Application_Start methods do not run in the same user contexts. For example if a drive is mounted in the OnStart method and the drive letter passed to the IIS process through some IPC means, the simulated drive will be unavailable in the IIS process when running in the development environment.
When running in the cloud, drives mounted are visible across the entire role instance. Note that with IIS HWC, Page_Load and OnStart are always in the same process and consequently this is not an issue.
Update 3/09/011: The below 3 storage emulator issues have been fixed in the Windows Azure SDK 1.4 release March 2011.
These are a few issues that have surfaced with SDK 1.3 and full IIS that we’ll cover in this section. It should be noted that none of these issues occur with IIS Hosted Web Core.
Dinesh, appreciate the update - however, when I switch to IIS in dev fabric I am failing to create a XDrive with an exception of 0x80070003
Works with HWC in dev fabric and I followed 1 & 3 on your list.
Marc, can you verify that the environment variable AZURE_DRIVE_DEV_PATH points to a valid drive on your system.
i have fixed HttpException (0x80004005) issue using support.microsoft.com/.../2468871 fix...
But now i am getting "Unable to connect to the remote server - A socket operation was attempted to an unreachable network 168.63.*.*:443" instead of "HttpRequst is not availble in this context" error... (But i can connect to the Destination Host in WorkerRole)
@Bin Hex, can you share some context here as to when you see this error? Is this when you try to establish connection with IIS service running on VM with Azure Drive? Or is this outbound connections?
Jai, The 2468871 fix solved the issue, Though outbound connection to that IP was not working due to our Network Proxy... I have resolved it by unblocking access to that IP address...
But i couldn't get one part... Before fixing our network proxy, i can connect to the *.core.windows.net in my Worker Role but i couldn't connect the same in my WebRole...Blindly unblocking the port fixed my problem...