I have an ASP.NET web application that calls a .NET DLL, that in turn calls a web service. The web service call is throwing an exception:
Unable to generate a temporary class (result=1). error CS0001: Internal compiler error (0xc00000fd) error CS0003: Out of memory
Stack Trace: at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type) at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) at System.Web.Services.Protocols.SoapClientType..ctor(Type type) at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
I should mention that this is the first time I have executed this particular bit of code on this PC (I recently did a Windows reformat/reinstall) — which makes me think it is a problem with the environment (the same application runs fine on our test and production servers). But I’m stumped as to the cause.
Some additional details to answer follow-up questions:
- This is a real PC (not a VM).
- I’m running .NET 3.5 on IIS 7. Our production servers are IIS 6, but it has worked correctly on IIS 7 before.
- The PC has 2 GB of RAM with plenty of that free.
- I haven’t changed any of the machine.config settings, nor any of the web.config settings related to process model, compilation, memory usage, etc.
- The local IIS_IUSRS group has read/write permissions for the ‘Temporary ASP.NET Files’ folder.
- I checked the application pool settings: both private memory and virtual memory are set to 0 (no limit).
Memory usage of the worker process:
- I recycled the worker process to get a clean slate and then hit an ASP.NET page in the application…Task Manager shows 22 MB used.
- I then hit the event that makes the web service call and the memory usage shoots up to about 150 MB, levels off, then I get the exception.
Well, I’m not sure exactly why this worked (which is frustrating), but I did come up with something…
My previous install of Windows was 32-bit, but when I rebuilt my PC recently, I went with the 64-bit version. So, I changed the ‘Enable 32-Bit Applications’ setting on my application pool in IIS to ‘True’, and everything seems to work fine now.
The DLL and the web site itself are configured to compile as ‘Any CPU’, so they shouldn’t have caused any problems on Win64. And the ‘out of memory’ error is still a bit perplexing (and unhelpful). If anyone has any ideas, you get the ‘accepted’ points.