Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF接收大字符串,获取异常_Wcf_Web Services - Fatal编程技术网

WCF接收大字符串,获取异常

WCF接收大字符串,获取异常,wcf,web-services,Wcf,Web Services,我浏览了所有关于这个的帖子,没有任何帮助,所以我发布了这个帖子,因为我正在把我的头发拔出来 我有一个WCFWeb服务,它有一个接收字符串的方法,一个长字符串。它适用于2390158个字符的字符串(已尝试),但不适用于大约5440519个字符的字符串。(我正在使用VS2010) 我有一个错误: System.ServiceModel.CommunicationException:接收HTTP响应HTTP://localhost:58014/WSWebService.asmx时出错。原因可能是连接端

我浏览了所有关于这个的帖子,没有任何帮助,所以我发布了这个帖子,因为我正在把我的头发拔出来

我有一个WCFWeb服务,它有一个接收字符串的方法,一个长字符串。它适用于2390158个字符的字符串(已尝试),但不适用于大约5440519个字符的字符串。(我正在使用VS2010)

我有一个错误:

System.ServiceModel.CommunicationException:接收HTTP响应HTTP://localhost:58014/WSWebService.asmx时出错。原因可能是连接端点服务不使用HTTP协议。这也可能是由于服务器忽略了HTTP请求上下文(可能是由于服务中断)

我将所有参数都放在int.MaxValue(2147483647)上,但它仍然不起作用。非常感谢您的任何帮助/建议

我删除了“超时”部分,但没有区别:

closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
以下是my app.config中的绑定:

<bindings>
    <basicHttpBinding>
        <binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                    maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
      </basicHttpBinding>
</bindings>

我的配置服务器端是:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
       maxBufferSize="20971520" maxBufferPoolSize="20971520"
       useDefaultWebProxy="true">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
</system.serviceModel>


是的,同样的配置。我遗漏了什么吗?

服务是基于ASMX的,重新使用纯WCF,现在就可以正常工作了。

您是否在客户端和服务器上共享此配置?请尝试增加maxReceivedMessageSize?我认为您也需要以相同的值添加MaxBufferSize。您需要在客户端和服务器上使用@PrestonGuillotDo所说的相同设置您是否有显式使用您定义的绑定的端点定义?如果没有,则.NET将(通过默认端点和绑定)使用
basicHttpBinding
的默认值。该服务似乎是一个ASMX服务。它不关心
元素。