在app.config中增加后运行WCF测试客户端并接收MaxReceivedMessageSize错误

时间:2014-10-07 13:12:58

标签: c# wcf visual-studio wcf-binding

我正在尝试在VS 2013中设置我的第一个WCF服务。我正忙着通过一个教程,但是遇到了麻烦......

运行一个简单的服务(DataViewerService),它调用数据库以返回记录集。我已将绑定更改为:

<bindings>
  <basicHttpBinding>
    <binding allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
    </binding>
  </basicHttpBinding>
</bindings>

在system.serviceModel中,直接在我已经包含

<services>
  <service name="DataViewerService.Service1">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/DataViewerService/Service1/" />
      </baseAddresses>
    </host>
    <endpoint address="http://localhost:2112/Viewer" 
              binding="basicHttpBinding" 
              contract="DataViewerService.IService1"> 
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

谷歌搜索,我读到的只是客户端和服务器都需要设置...但是,我在localhost上运行,我在wcf测试客户端内消耗。我似乎无法弄清楚我需要做出哪些其他改变...我到底错过了什么?

1 个答案:

答案 0 :(得分:8)

enter image description here您需要在WCF测试客户端上编辑配置。

在添加的服务底部,您将看到名为&#34; Config file&#34;的节点。

尝试最小化合同以便查看