Let's start from
the point that you have an ASP.NET based WebRole as MainWebRole.DLL which you
have created using Windows Azure SDK 1.3. The ServiceConfiguration.CSDEF
setting can run your webrole in following two modes:
1. Full IIS
2. HWC (Hostable
Web Core) Mode
Full IIS Mode:
from Full IIS Mode. In this mode you will have your ServiceConfiguration.CSDEF
will have a section name <Sites> as below:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureVMAssistant" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<Binding name="Endpoint1" endpointName="Endpoint1" />
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
highlighted <Sites> part is important as it makes your application to run
in Full IIS mode. When you RDP to your Windows Azure VM you will see two
processes are handing your service:
If you look
for the .net assemblies in both the above process you will see the MainWebRole.DLL
is loaded with both the process.
HWC (Hostable Web Core) Mode
In this mode
you will have your ServiceConfiguration.CSDEF will MUST have cmmented the
<Sites> section as below:
the above change caused your application to run very differently. You will see
only one process WaWebHost.EXE is taking care of your application and our MainWebRole.DLL
is loaded in this process as below:
The gist to
understand here that there is a significant difference in how your code is
hosted in Windows Azure depending on whether you choose HWC or Full IIS.
As you know
that your Web Role have two important pieces:
(OnStart method of your WebRole class which derives from RoleEntryPoint)
public class WebRole : RoleEntryPoint
information on handling configuration changes
the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
When you have select to use HWC Mode:
The RoleEntryPoint methods and your web site itself run under the WaWebHost.exe
In the following
diagram you can see how MainWebRole.dll is hosted in WaWebHost.EXE
When you have select to use full IIS
1. RoleEntryPoint runs under WaIISHost.exe,
2. Your web site runs under a normal IIS w3wp.exe process.
In the following
diagram you can see how MainWebRole.dll is hosted in WaIISHost.EXE & w3wp.exe
decide to upgrade your ASP.NET web role from Windows Azure SDK 1.2 to Windows
Azure SDK 1.3, please consider following scenarios as below:
1. Configuration Settings in Full IIS
You will see
on common problem with full IIS that code running in RoleEntryPoint cannot read
web.config and cause error.
for this problem is that your web site uses web.config as configuration file
however RoleEntryPoint does not have access to web.config because RoleEntryPoint
code is running in separate process (WaIISHost.exe) then the website (w3wp.exe).
WaIISHost.exe process looks configuration settings in a file name WaIISHost.exe.config
so you will need to create a file name WaIISHost.exe.config with all the
necessary settings and place along with your application to avoid such problem.
2. Problem accessing Static Members
from your Web site and RoleEntryPoint
RoleEntryPoint and Website is running on two separate processes the static members
will not be shared in between these two.
After I upgraded from Azure SDK 1.2 to 1.4 my application's web role cannot access SQL Azure. If I change the csdef file to HWC mode as you explained, it works.
Now my question is how can I use Full IIS mode and yet access SQL Azure?