English 中文(简体)
调用 Web 服务时出现“内存不足”异常
原标题:
  • 时间:2009-01-21 17:01:10
  •  标签:

我有一个调用.NET DLL的ASP.NET Web应用程序,进而调用Web服务。 Web服务调用抛出异常:

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()

我应该提到这是我第一次在这台电脑上执行这个特定的代码(我最近进行了Windows重新格式化/重新安装) - 这让我认为这是一个环境问题(相同的应用程序在我们的测试和生产服务器上运行良好)。但我很困惑原因在哪里。


一些额外的细节来回答跟进问题:

  • 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).

工作进程的内存使用情况:

  • 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.
最佳回答

嗯,我不确定为什么这个起作用了(令人沮丧),但我确实想出了一些东西...

我的先前的Windows安装是32位的,但最近我重新构建了我的电脑,选择了64位版本。因此,我在IIS的应用程序池中将“启用32位应用程序”的设置改为“True”,现在一切似乎都正常工作。

DLL和网站本身都配置为“任意CPU”进行编译,因此它们不应该在Win64上引起任何问题。而“内存不足”错误仍然有些令人困惑(并且不太有帮助)。如果有人有任何想法,你就得到了“已接受”的积分。

问题回答

谢谢你添加更多细节。

Have a look at this link: http://support.microsoft.com/?kbid=908158
It s similiar to the problem you re having.

It recommends the following: To resolve this issue, grant the user account the List Folder Contents and Read permissions on the %windir%Temp folder.

This one:
http://club.workflowgen.com/scripts/club/publigen/content/templates/show.asp?P=53&L=EN

recommends:
To avoid this problem, give read/write priviledges for the Temp folder to the ASPNET account. When ASP.NET Web Services process WebMethods, the identity that is used most frequently to gain access to the system Temp folder is the local ASPNET account, which is the default account under which ASP.NET applications run.

然而,如果您已经在Web.config文件中配置了您的应用程序使用扮演操作,线程也可以使用任何调用者的身份。如果是这种情况,则所有潜在的调用身份都必须具有对Temp文件夹的读/写权限。一个可能的呼叫身份是Internet Information Services(IIS)应用程序的匿名帐户(通常是ISUR_xxx帐户)。线程也可以使用IWAM_xxx帐户或NETWORK SERVICE。

它正在尝试编译, 是否需要访问某个临时目录的可写权限。





相关问题
热门标签