App Service: There is not enough space on the disk.

Роман Губ'як 11 Reputation points
2020-12-09T16:37:57.797+00:00

I have .NET Core 3 application that is hosted on Azure as App Service. Recently, I started getting the following error: There is not enough space on the disk. : 'D:\local\Temp\ASPNETCORE_20a05c3e-82e9-480d-8c48-3362a1454a8a.tmp'. Here is the stack trace:

at System.IO.FileStream.SetLengthCore(Int64 value)     at System.IO.FileStream.WriteAsyncInternalCore(ReadOnlyMemory`1 source, CancellationToken cancellationToken)     at System.IO.FileStream.WriteAsyncInternal(ReadOnlyMemory`1 source, CancellationToken cancellationToken)     at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)     at Microsoft.AspNetCore.WebUtilities.PagedByteBuffer.MoveTo(Stream stream)     at Microsoft.AspNetCore.WebUtilities.FileBufferingWriteStream.Write(Byte[] buffer, Int32 offset, Int32 count)     at Microsoft.AspNetCore.WebUtilities.HttpResponseStreamWriter.Write(String value)     at Newtonsoft.Json.Utilities.JavaScriptUtils.WriteEscapedJavaScriptString(TextWriter writer, String s, Char delimiter, Boolean appendDelimiters, Boolean[] charEscapeFlags, StringEscapeHandling stringEscapeHandling, IArrayPool`1 bufferPool, Char[]& writeBuffer)     at Newtonsoft.Json.JsonTextWriter.WriteEscapedString(String value, Boolean quote)     at Newtonsoft.Json.JsonWriter.WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, Object value)     at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)     at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)     at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)     at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)     at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)     at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)     at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)     at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,967 questions
{count} votes

3 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2020-12-10T15:55:46.623+00:00

    Thanks for asking question! You may want to know that App Service is a service running on top of the Azure PaaS (platform as a service) infrastructure. As a result, the local drives that are "attached" to a virtual machine are the same drive types available to any worker role running in Azure. This includes:

    • An operating system drive (the D:\ drive)
    • An application drive that contains Azure Package cspkg files used exclusively by App Service (and inaccessible to customers)
    • A "user" drive (the C:\ drive), whose size varies depending on the size of the VM.

    So, Its important to monitor your disk utilization as your application grows. If the disk quota is reached, it can have adverse effects to your application. For example:

    • The app may throw an error indicating not enough space on the disk.
    • You may see disk errors when browsing to the Kudu console.
    • Deployment from Azure DevOps or Visual Studio may fail with ERROR_NOT_ENOUGH_DISK_SPACE: Web deployment task failed.
    (Web Deploy detected insufficient space on disk).
    • Your app may suffer slow performance.

    Also, its little tricky to figure out this issue as you may have multiple Web Apps in an App Service Plan. If one of the Web Apps is taking more disk space than the others, you may not be able to easily identify which Web App to investigate.

    You can monitor the disk space under “Quotas” tab at the Web App level. Go to Web App -> Quotas -> you can see the File System Storage.

    46906-inkeddemo2-li.jpg

    Also, try checking the App Service Plan quotas by going to App service plan and selecting Quotas. Additionally suggest you to check the application files in the D:\home\site\wwwroot from the Azure kudu tool (https://yoursite.scm.azurewebsites.net/) and available disk space on the Environment page. You may try increasing the pricing tier plan and see if that helps to resolve the issue.

    Also, Please check below articles on this:

    Azure App Service - What is taking my disk space for my Azure Web App ?

    Review and manage your web site disk space in Azure

    Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.

    4 people found this answer helpful.

  2. Chris Briggs 11 Reputation points
    2021-01-04T22:14:24.61+00:00

    We are having the same issue and it appears to be Temp files, not the File Storage. No solution yet other than restarting the app maybe, that is suppose to clear the Temp files from my understanding.

    Your Temp quota is based on your App Service Plan and shared with all apps on that plan.

    53299-image.png

    2 people found this answer helpful.

  3. Dom Barnes 11 Reputation points
    2021-11-12T15:24:38.093+00:00

    Having basically the same issue. We run a few app services on an ASP. Quota's report total usage there is 2.2GB (400-600MB in total, of which about 400MB is our website files).
    We are making a folder in our app site folder, not the OS's %TEMP% location and are getting this:

    There is not enough space on the disk. : 'D:\home\site\wwwroot\_temp\0044dc92-f0e3-49fa-af74-26276d26f75c\MyVideo.MOV'
    

    The file is about 900MB. Quota's show our threshold for the RG/region is 500GB, using around 2.2% total. KUDU Environment shows similar numbers

    D:\home - 512,000MB Total, 504,616 MB Free
    D:\local - 21,504 MB Total, 18,768 MB Free

    And yet get get the System.IO.IOException raised.
    ASP is a P1v2 (3 instances)

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.