If you have deployed an ASP.NET based service on Windows Azure and while uploading a large file using ASP.NET upload functionality or HTTP upload, you might receive the following error:

Error: There is not enough space on the disk

 

This error could appear in several way however a few are described as below:

 

Case [1]: While accessing your ASP content you might hit the following error just randomly:

Server Error in '/' Application.

--------------------------------------------------------------------------------

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: There is not enough space on the disk.

 

Case [2]: You might get this error when you will use ASP upload function to upload a file which is larger than 100MB or in some case under 100 MB.

There is not enough space on the disk.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: There is not enough space on the disk.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

Stack Trace:

[IOException: There is not enough space on the disk.]

   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10546789

   System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) +10351324

   System.Web.TempFile.AddBytes(Byte[] data, Int32 offset, Int32 length) +26

   System.Web.HttpRawUploadedContent.AddBytes(Byte[] data, Int32 offset, Int32 length) +327

   System.Web.HttpRequest.GetEntireRawContent() +515

   System.Web.HttpRequest.GetMultipartContent() +72

   System.Web.HttpRequest.FillInFormCollection() +248

   System.Web.HttpRequest.get_Form() +79

   System.Web.HttpRequest.get_HasForm() +73

   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +54

   System.Web.UI.Page.DeterminePostBackMode() +90

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +268

 

Case [3]: While you are uploading a large file to Azure blob storage from your ASP page you might get the same error:

FileUploaderHandler: There is not enough space on the disk.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)

at System.Web.HttpRawUploadedContent.TempFile.AddBytes(Byte[] data, Int32 offset, Int32 length)

at System.Web.HttpRawUploadedContent.AddBytes(Byte[] data, Int32 offset, Int32 length)

at System.Web.HttpRequest.GetEntireRawContent()

at System.Web.HttpRequest.get_InputStream()

at WebRole1.FileUploadHandler.ProcessRequest(HttpContext context)

 

In all the above cases as well as the others who receive similar exception the problem is same. The problem is that the ASP use a temp directory size which includes compiled binary as well as used as the temp folder while uploaded. At any given time, depend on available space in the temp directory, you will face a file upload limitation with files size 100MB or higher and in some case files under 100MB as (when there are lots and lots of compiled ASP content. The following factors with TEMP folder are causing this issue;

  1. The maximum size of ASP temp folder is 100 MB
  2. The size of ASP temp folder cannot be changed
  3. The ASP TEMP folder location cannot be changed
  4. IIS main configuration cannot be changed for several other reasons so even when you will use:

<httpRuntime maxRequestLength="<Some_High_Value>" executionTimeout="3600" />

Or

<requestLimits maxAllowedContentLength="<Some_High_Value>" />


So even when you are using webserver settings to extend the upload size, still the default temp size cannot be changed. As the ASP temp folder location and size is fixed for 100MB so user cannot upload more than 100MB files or if the temp folder is filled with ASP binaries then page accessibility could be another issue.

 

Also in case of someone accessing Azure Storage from ASP (Case #3), the same problem also cause this error. And the reason for this error is that when you will use Azure Storage API in ASP i.e. (UploadFromStream() function within ASP) the file will be uploaded using HTTP Post method from your machine to Azure Service first and then transferred from ASP temp folder to Azure Storage. This will hit the same problem as I described earlier. So in summary, UploadFromStream() doesn’t use the temp folder, but ASP.NET handling an incoming HTTP post does which will cause the problem.


Solution: 

If you are using Cloud SDK 1.2 you have the following options to solve this problem:

1.       Use 3rd party ASP upload component which does not use ASP.NET temp folder

2.       User Silverlight based HTTP upload which does not use ASP TEMP folder

3.       Create your own ASP.NET upload component which does not use ASP.NET temp folder

4.       You can also solve this problem by running IIS inside the worker role which is also defined as “Hostable Web Core (HWC)”. This is a little complex solution however if you really have no way to live with the problem and need solution, HWC is the best way to go. There are lots of companies using HWC solution so it is a good solution if needed. You should be able to take smarx’s blog post (link below) to start HWC sample:

http://blog.smarx.com/posts/build-your-own-web-role-running-hosted-web-core-in-windows-azure

I have also created the following tutorial to use the sample at dev fabric and on cloud which will be very helpful to you also

http://hwcsample.cloudapp.net/

With Cloud SDK 1.3, which is scheduled to release by end of this year (2010), you can use the IIS role in the service then your web.config setting will work to change the ASP temp folder size or location. As of now SDK 1.3 is not publically available so if you follow this solution you will have to wait its release.