【问题标题】:Running WCF Test Client and receiving MaxReceivedMessageSize error after increasing in app.config运行 WCF 测试客户端并在 app.config 中增加后收到 MaxReceivedMessageSize 错误
【发布时间】:2014-10-07 13:12:57
【问题描述】:

我正在尝试在 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 测试客户端中使用。我似乎无法弄清楚我还需要在哪里进行这些更改...我到底错过了什么?

【问题讨论】:

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


    【解决方案1】:

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

    在您添加的服务的底部,您将看到一个名为“配置文件”的节点。

    尝试最小化您的合同以查看它

    【讨论】:

    • 在我的服务下的解决方案资源管理器中,我看到六个节点:Properties、References、App.config、IService1.cs、packages.config 和 Service1.cs。我已经在 App.config 中进行了更改...我没有看到其他节点指示配置。
    • 不是您的服务,而是连接到您的服务的客户端(具有“服务引用”或“客户端”)
    • 不在您的解决方案中 - 在您的 WCF 测试客户端中。
    • 我用截图更新了帖子。 wcf 测试客户端是一个客户端,它将使用默认值 - 您需要编辑这些默认值
    • 这对我不起作用。我确定它曾经……Windows 10? Visual Studio 2013
    猜你喜欢
    • 1970-01-01
    • 2015-12-18
    • 2011-09-06
    • 2015-10-18
    • 2013-07-05
    • 1970-01-01
    • 1970-01-01
    • 2012-06-04
    • 1970-01-01
    相关资源
    最近更新 更多