从 VB6 调用 WCF 时如何增加 maxReceivedMessageSize?
目前我有: 1 ) WCF 设置返回 xml 块(具体来说,它是来自 Exchange 2003 的日历的内容)。 2 ) 一个带有命令的 vb6 表单,该命令通过基于服务名称(包括 WSDL 合同文件的内容)构建的对象来访问 WCF。
仅当传递的字符串具有可接受的大小时,此方法才能正常工作。当我尝试返回 WCF 端生成的整个 xml 时,我遇到以下错误: “已超出传入消息的最大消息大小配额 (65536)。要增加配额,请在相应的绑定元素上使用 MaxReceivedMessageSize 属性。”
当我将绑定配置添加到 WCF 应用程序配置中以增加 maxReceivedMessageSize 时,这没有任何效果 - 大概是因为 VB6 客户端对此视而不见。 (生成的 WSDL 合约甚至不包含其 xml 中的值)
阅读周围*,有人建议我需要在客户端进行类似的配置更改。所以我创建了一个 VB6.EXE.CONFIG 文件并将绑定配置详细信息复制到此。然后我扩展了这个绰号以包括以下内容: binding=WSHttpBinding_IExchange, bindingNamespace='Exchange', bindingConfiguration='ExchangeBinding'
但是,我仍然收到有关大小配额的相同错误消息。
当拼写错误上面名字的绑定或绑定命名空间元素时,我会得到一个预期的错误,但是当错误拼写绑定配置元素时,我不会得到错误,就好像这个元素无论如何都是不相关的。
我目前似乎已经有了一些部分,但还没有可行的解决方案。有人有什么想法吗?
- obj 对象被声明为接口代理类型。然后将名字对象设置为仅包括地址和绑定类型。由于您仅使用 wsHttpBinding 的默认设置,因此不需要提供 bindingConfiguration 值。如果您需要覆盖绑定的任何默认设置,您可以提供一个名为 file.exe.config 的应用程序配置文件,并将其放置在客户端的程序目录中
At the moment I have:
1 ) a WCF setup to return a block of xml (specifically it is the contents of a calendar from Exchange 2003).
2 ) a vb6 form with a command on it accessing the WCF via an object built on the service moniker including the content of the WSDL contract file.
This is working fine only when the string being passed across is of an acceptable size. When i attempt to return the whole xml generated on the WCF-side i encounter the following error:
"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."
When i add a binding-configuration into the WCF app-config to increase the maxReceivedMessageSize, this has no effect - presumably as the VB6 client is blind to this. (the WSDL contract generated doesn't even include the value in its xml)
Reading around*, there is the suggestion that i need to make a similar config change on the client-side. So i have created a VB6.EXE.CONFIG file and copied the binding-configuration details to to this. i have then extended the moniker to include this :
binding=WSHttpBinding_IExchange, bindingNamespace='Exchange', bindingConfiguration='ExchangeBinding'
I am however still receiving the same error message regarding the size quota.
when mis-spelling the binding or bindingNamespace elements of the moniker above i get an expected error, but when mis-spelling the bindingConfiguration element i get no error, as if this element is irrelevant anyway.
I seem to have the pieces but not the working solution at the moment. Any ideas anyone?
- The obj object is declared to be of the interface proxy type. The moniker is then set to include only the address and the binding type. Since you’re using just the default settings for the wsHttpBinding, you aren’t required to supply a bindingConfiguration value. If you required overriding any of the default settings for the binding, you could supply an application configuration file with the name file.exe.config and place it in the program directory of the client
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就个人而言,我会创建一个 .NET COM 公开库,您可以从 VB6 调用该库。 .NET 库可以控制所有客户端绑定,而 VB6 将简单地与 DLL 通信并传递字符串。
Personally, I would create a .NET COM exposed library that you call from the VB6. The .NET library could control all of the client binding and VB6 would be simply talking with a DLL and passing strings around.