After working in one Windows Azure issue in which the ASP.NET Web
Role was stuck in between "Busy" and "Starting", I decided to write the details
to save some time for someone.
After I logged in to Windows Azure VM and looked for Application
Event logs I found the following two errors:
Log Name: Application
Source: ASP.NET 2.0.50727.0
Date: 02/02/2011 12:36:20 AM
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 02/02/2011 12:36:20 AM
Event time (UTC): 02/02/2011 12:36:20 AM
Event ID: d209883d329447298110ba8ec3691534
Event sequence: 4
Event occurrence: 1
Event detail code: 0
Application domain: /LM/W3SVC/1/ROOT-1-129314037651185446
Trust level: Full
Application Virtual Path: /
Application Path: E:\approot\
Machine name: XXXXXXXXXXXXXXXX
Process ID: 1868
Process name: WaWebHost.exe
Account name: CIS\xx-xx-xx-xx-xx-xx-xx-
Request URL: http://xx.xx.xx.xx:20000/do.__rd_runtime_init__
Request path: /do.__rd_runtime_init__
User host address: xx.xx.xx.xx
Is authenticated: False
Thread account name: CIS\XXXXX-XXXXX-XXXXX-XXXX
Log Name: Application
Source: Application Error
Date: 02/02/2011 12:30:07 AM
Event ID: 1000
Task Category: (100)
Faulting application WaWebHost.exe, version 6.0.6002.18006, time
stamp 0x4beb1a60, faulting module kernel32.dll, version 6.0.6002.18005, time
stamp 0x49e041d1, exception code 0xe0434f4d, fault offset 0x00000000000176fd,
process id 0x%9, application start time 0x%10.
After little more debugging I found that the ASP.NET Web Role
was keep crashing because the code was trying write into a file name "StreamLog.txt"
in the RoleRoot folder as below:
Message: Access to the
path 'E:\approot\StreamLog.txt' is denied.
The Web Role based web site is running you don't have write access
to RoleRoot folder and if any user who access the website and the underneath code tries to write in RoleRoot folder the website host process, will generate an exception as described above. If you have a web role or worker role in Windows Azure application and you have a requirement to write content in a file, then the best solution is the create a local storage and create file and write into the files accessing Local Storage as you writable folder.