代码之家  ›  专栏  ›  技术社区  ›  R. Paiva

当请求太大(30 Mb以上)时,无法访问终结点

  •  1
  • R. Paiva  · 技术社区  · 8 年前

    我正在尝试通过MVC和WCF上传文件。

    <binding name="BasicHttpBinding_IFile" closeTimeout="00:30:00"
          openTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647" messageEncoding="Mtom" />
    

    当我调用我的WCF时,问题就出现了。端点就在MVC项目和web上。WCF上的配置具有以下绑定:

    <basicHttpBinding>
        <binding name="FileUploadServiceBinding"
                 transferMode="Streamed"
                 messageEncoding="Mtom"
                 maxBufferPoolSize="2147483647"
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647"
                 receiveTimeout="00:30:00"
                 openTimeout="00:30:00"
                 closeTimeout="00:30:00"
                 sendTimeout="00:30:00">
          <security mode="None">
            <transport clientCredentialType="None" />
          </security>
          <readerQuotas maxDepth="100"
                        maxStringContentLength="2147483647"
                        maxArrayLength="2147483647"
                        maxBytesPerRead="4096"
                        maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    

    我正在发送25Mb的文件,它正在工作,但当我尝试上载30Mb或更大的文件时,我的项目无法访问该服务,并抛出以下错误消息:

    “在上没有侦听终结点 http://localhost:55010/FileService.svc 能够接受消息。“这通常是由不正确的SOAP地址或操作引起的。获取更多详细信息。”

    2 回复  |  直到 8 年前
        1
  •  0
  •   tomasr    8 年前

    如果您在IIS Express或IIS中托管服务,则可能是 maxAllowedContentLength 请求过滤模块的默认值为30000000。

    尝试通过在你的网站中添加以下内容来增加它。配置文件:

    <system.webServer>
      <security>
        <requestFiltering >
          <requestLimits maxAllowedContentLength="52428800" />
        <requestFiltering>
      </security>
    </system.webServer>
    
        2
  •  0
  •   R. Paiva    8 年前

    我修复了服务器web上的问题。使用以下行进行配置:

        <httpRuntime targetFramework="4.5" enableVersionHeader="false" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
    

    推荐文章