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
.net 在wcf rest服务的客户端中设置MaxReceivedMessageSize_.net_Wcf_Rest - Fatal编程技术网

.net 在wcf rest服务的客户端中设置MaxReceivedMessageSize

.net 在wcf rest服务的客户端中设置MaxReceivedMessageSize,.net,wcf,rest,.net,Wcf,Rest,我有一个rest WCF服务,我使用控制台应用程序连接到该服务。控制台应用程序下载一个文件。小文件很好用。对于较大的文件,我得到以下错误: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element

我有一个rest WCF服务,我使用控制台应用程序连接到该服务。控制台应用程序下载一个文件。小文件很好用。对于较大的文件,我得到以下错误:

The maximum message size quota for incoming messages (65536) has been exceeded. 
To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element
这是我在客户端控制台应用程序上的配置文件

<configuration>     
<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding maxReceivedMessageSize="2000000"
                  maxBufferSize="2000000">
          <readerQuotas maxStringContentLength="2000000"/>
        </binding>
      </webHttpBinding>
    </bindings>
    </system.serviceModel>
</configuration>

WCF配置如下所示:

    <webHttpBinding>
        <binding name="MyTestBinding" maxReceivedMessageSize="10000000" maxBufferPoolSize="10000000" maxBufferSize="10000000" transferMode="Buffered">
            <readerQuotas maxDepth="10000000" maxArrayLength="10000000" maxBytesPerRead="10000000" maxNameTableCharCount="10000000" maxStringContentLength="10000000" />
            <security mode="Transport">
                <transport clientCredentialType="None" />
            </security>
        </binding>
    </webHttpBinding>


我正在使用WebChannel Factory连接到该服务。可能有什么问题?

尝试为客户端配置文件中的
webHttpBinding
指定一个名称,并使用引用。这将使用一个字符串作为绑定配置名称和服务的Uri:

<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding name="MyWebHttpBinding">
        <binding maxReceivedMessageSize="2000000"
                 maxBufferSize="2000000">

WCF support MaxRecivedMessageSize为2147483647。您必须同时设置客户端和服务。我希望看到您的WCF配置设置将服务行为添加到您的服务配置中,以显示正在使用的端点。谢谢。但是,在创建工厂实例时,我必须提供一个绑定对象。该字符串是一个端点配置名称。我在java应用程序中使用c#wcf服务,我在其中配置了该名称MaxBufferSize@R.Anandan-这将出现在Java客户端的cofig或代码中。我建议你将此作为一个新问题发布,并附上相关信息。
WebChannelFactory<IContract> factory = new WebChannelFactory<IContract>("MyWebHttpBinding", new Uri("service address"));