.net - File.WriteAllBytes导致错误 "Insufficient system resources exist to complete the requested service"

标签 .net web-services soap

我有一个带有WebMethod的标准SOAP Web服务,该方法接受一个字节数组,然后执行

[WebMethod(true)]
WriteFile(byte[] Data, string FilePath)
{

    File.WriteAllBytes(FilePath, Data);
}

如果此过程通过了一个大文件,例如2兆它正在轰炸,并显示以下错误消息:

Insufficient system resources exist to complete the requested service



查看堆栈跟踪,我得到:
  • System.IO.File.WriteAllBytes
  • System.IO.FileStream.Write
  • System.IO.FileStream.WriteCore
  • System.IO .__ Error.WinIOError
  • System.IO.IOException:系统资源不足,无法完成所请求的服务

  • 我已经尝试了所有显而易见的事情,例如将maxrequeSTLength设置和将超时执行为更实际的设置:
    <httpRuntime maxRequestLength="409600" executionTimeout="900"/>
    

    似乎仍然无法通过以上方法进行故障转移。如果发送较小的文件,则可以保存到磁盘上。.因此,问题在于文件大小或时间。

    有谁知道我能做些什么来解决这个问题?

    谢谢

    戴夫

    最佳答案

    我知道您没有达到此文件大小,但也要知道File.WriteAllBytes写入网络路径时的限制为64mb-请参阅此connect issue

    关于.net - File.WriteAllBytes导致错误 "Insufficient system resources exist to complete the requested service",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/995320/

    相关文章:

    c# - 设计 C# SOAP API 客户端/包装器

    java - 如何在WebSphere中拦截SOAPMessage

    .net - 从 C# 切换到 VB.Net

    c# - printdocument 打印问题只打印第一页

    json - Microsoft Academic API 按标题搜索

    java - 构建我们的 Java 包

    c# - WCF 无法将文件作为流返回

    soap - 用拦截器更改 CXF 中的前缀

    c# - 使用 MVVM,当控件没有 "Command"属性时怎么办?

    c# - 不可见的控件仍在渲染