使用名字对象字符串从Excel调用WCF服务并且已超出maxReceivedMessageSize的错误65356

时间:2014-04-17 12:39:10

标签: excel wcf excel-vba moniker vba

我成功地能够使用mexTcpBinding和moniker string调用WCF服务下面是用于构建名字对象字符串的vb脚本

    Dim addrToWCFService As String
addrToWCFService = "service4:mexAddress=net.tcp://10.44.19.20/PruCapWebCMHost/API/Excel/ExcelAPIService.svc/mexTCP, "
addrToWCFService = addrToWCFService + "address=net.tcp://10.44.19.20/PruCapWebCMHost/API/Excel/ExcelAPIService.svc, "
 addrToWCFService = addrToWCFService + "contract=IExcelAPIService, contractNamespace=http://Excel/Services, "
addrToWCFService = addrToWCFService + "binding=NetTcpBinding_IExcelAPIService, bindingConfiguration=IExcelAPIService, bindingNamespace=http://Excel/Services"

web.config中的服务配置是

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="NetTcpBinding_IPublicService" maxReceivedMessageSize="8388608" maxBufferSize="8388608" portSharingEnabled="true">
      <security></security>
    </binding>
  </netTcpBinding>
</bindings><services>
<service name="ExcelAPI.ExcelAPIService" behaviorConfiguration="PublicServiceTypeBehaviors">
    <endpoint address="" bindingNamespace="http://Excel/Services" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IPublicService" contract="ExcelAPI.IExcelAPIService" name="NetTcpBinding_IExcelAPIService" />
    <endpoint address="mexTCP" bindingNamespace="http://Excel/Services" binding="mexTcpBinding" contract="IMetadataExchange" bindingName="NetTcpBinding_IPublicService" name="MexTcpBinding_IExcelAPIService"/>
 </service>

 

当我调用其中一个返回大于65356大小的数据的方法时,我收到错误消息“已超出传入消息的最大邮件大小配额(65534)。要增加使用的配额,请使用MaxReceivedMessageSize属性在适当的绑定元素“

现在我正在努力将这个属性设置为更高的值。我尝试创建Excel.exe.config文件并放入Excel.exe文件夹。我现在想要如何在我的情况下将MaxReceivedMessageSize设置为值“8388608”以及需要将哪个配置文件设置为Excel.exe.config或其他将告诉moniker代理使用的内容。任何人都可以帮我解决这个棘手的问题。

我已经创建了以下添加的Excel.exe.config文件,但有些人如何不采取这些设置,任何人都可以帮助我解决这个问题。或确认这是绰号代理的固有问题或限制?

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.serviceModel>
        <bindings>
          <netTcpBinding>
            <binding name="IExcelAPIService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                maxBufferPoolSize="8388608" maxBufferSize="8388608" maxConnections="10"
                maxReceivedMessageSize="8388608">
              <security >
              </security>
            </binding>
          </netTcpBinding>
        </bindings>
        <client>
          <endpoint address="net.tcp://10.44.19.20/PruCapWebCMHost/API/Excel/ExcelAPIService.svc"
              binding="netTcpBinding" bindingConfiguration="IExcelAPIService"
              contract="IExcelAPIService" name="NetTcpBinding_IExcelAPIService">
          </endpoint>
        </client>
      </system.serviceModel>
    </configuration>

1 个答案:

答案 0 :(得分:0)

你看过this solution了吗?我认为它会解决你的问题。

从WCF测试客户端调用时,是否会出现相同的错误?