使用monikerstring从Excel调用WCF服务并获取65356的maxReceivedMessageSize错误已被超出

我成function够使用mexTcpBinding和monikerstring调用WCF服务下面是用于构buildmonikerstring的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中的服务configuration是

 <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属性绑定元素“

现在我正在努力把这个属性设置为更高的价值。 我试着创buildExcel.exe.config文件并放入Excel.exe文件夹。 我现在想要如何设置MaxReceivedMessageSize值为“8388608”在我的情况下,哪个configuration文件需要设置Excel.exe.config或别的什么,这将告诉绰号代理使用。 任何人都可以帮助我解决这个棘手的问题。

我已经创buildExcel.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> 

你看过这个解决scheme吗? 我认为这将解决你的问题。

调用窗体WCF Test客户端时是否得到相同的错误?

Interesting Posts