I've been trying to package/publish my Azure project for awhile now (but to no avail). I've tried the following:
How do I circumvent this OutOfMemoryException? I'm currently running VS2012 with 12GB of RAM, so while I think the project is quite large (many, many subprojects), I'd think my machine would be able to handle it. The exception is as follows:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.1\Microsoft.WindowsAzure.targets(2866, 5): error : Exception of type 'System.OutOfMemoryException' was thrown. [C:\Users\..\WindowsAzure.ccproj]
It's been very frustrating, I'd be extremely grateful if anyone could offer me some friendly advice!
An OutOfMemoryException exception has two major causes: You are attempting to expand a StringBuilder object beyond the length defined by its StringBuilder. MaxCapacity property. The common language runtime cannot allocate enough contiguous memory to successfully perform an operation.
OutOfMemoryException Exception of type 'System. OutOfMemoryException' was thrown. To resolve this issue, I had to restart Visual Studio or go to the Windows Task Manager and terminate IIS Express process. This error could happen due to a variety of reasons related to memory consumption of the application.
To avoid this exception while working with StringBuilder, we can call the constructor StringBuilder. StringBuilder(Int32, Int32) and can set the MaxCapacity property to a value that will be large enough to serve the accommodation required when we expand the corresponding StringBuilder object.
This error can occur not just because of the package size. We occasionally receive this error, but a simple restart of Visual Studio resolves the issue.
This is typically caused by trying to place too much content into your package, not by how many projects you reference. There is a maximum size that can be placed into the .cspkg zip stream, and there is a maximum size of .cspkg that can be uploaded to Azure (600 MB).
You should remove all static content such as images, audio, or video from your package and instead place those assets into blob storage. You can change hrefs so that customers directly download the contents from blob storage, or you can use something like the Azure Boostrapper to download content to the VM on startup.
Also, btw, the amount of RAM you have on your machine is in no way related to getting OutOfMemoryException in any application (unless you have too small of a swap file, but that is a different issue).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With