Share via


Azure: There is not enough space on the disk

Problem

There may be some times where you will see this message when developing an application for Windows Azure.  The message will look like:

 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

The typical situation where you will see this is if you are using the ASP.NET FileUpload control to let users upload files.

If the file they try to upload exceeds 100 MB, it will error with this message.

Resolution

There are a few ways that you can work around this issue.  The best solution would be to use Silverlight to handle the upload instead of the ASP.NET FileUpload control.  By using Silverlight, you can have the client directly upload the file to blob storage and reduce how many places the file gets copied.

There are also some 3rd party controls that you can use to do this as well.

More Information

The problem with the ASP.NET FileUpload control is that it writes the file to a temp folder during upload.  The folder that is used in Windows Azure is limited to 100 MB so if you try to write something larger then that, it will fail.

I haven’t tested this, but if you have multiple users uploading data at the same time, you could see the same problem.  For example, if 15 users all upload a 10 MB file at the same time, the temp folder will probably fill up and give the same error.

Note: there is a setting that you may be temped to use which is the tempDirectory attribute off the compilation element.  If you try to set this to anything, it will cause your Web Role to not start up.