WCF 最大消息大小
我有两个服务,并且在它们之间发送相当大的消息(~100kb)。 尽管前面提到的值是消息大小的典型值,但它可能会大幅波动(正向和负向)。
因此,为了处理我必须传输膨胀消息的情况,我在客户端和服务器端的 app.config 中调高了所有最大消息大小、最大字符串大小等属性(相关端点正确引用了绑定)其中规定了尺寸)。
为了安全起见,我设置的界限完全超出了任何可能的消息大小。 然而,当服务间通信在消息大小规模的较低端被证明是可靠的时,在较高端则并非如此——消息似乎根本没有被传送。
最奇怪的是,如果消息超过了最大大小,那么就会抛出异常(我遇到过足够多的异常,知道这一点!哈哈),但什么也没有抛出 - 这一切都完全安静地过去了。 我已经尝试过各种大小的消息,并且它肯定只会随着消息大小的增长而开始发生。 我可以证明目标服务没有接收到,因为在接收时,该服务会在数据库中生成日志 - 但对于大消息,不会生成日志。
正如我所说,我几乎可以肯定我已经增加了 app.config 中所有适用属性的大小,因此我对这种行为完全感到困惑!
关于什么可能导致这种神秘行为有什么建议吗?
I have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions).
Thus, to deal with such situations where i have to transport a swollen message I have cranked up all the max message size, max string size etc attributes in the app.config on both client and server end (with the relevant endpoint correctly referencing the binding which states the sizes).
The bound I have put in completely exceeds any possible message size for safety's sake. However, where the inter-service communication has proved reliable at the lower end of the message size scale, at the higher end this is not so - messages do not seem to be delivered at all.
The strangest thing is that if the message had exceeded max size then an exception would be thrown (I have encountered enough of these to know this! lol), but nothing gets thrown - it all passes by completely silently. I have experimented with various sizes of messages and it definitely only begins to happen as the message size grows. I can prove are not being received by the destination service as, upon reception, the service makes a log in a DB - but with big messages, no log is made.
As I said, I am almost certain I have increased the size of all applicable attributes in the app.config, and so am completely and utterly baffled by this behaviour!
Any suggestions on what could be causing such mystifying behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,这个问题似乎已经解决了(突然之间,之前从未抱怨过,WCF 开始对 app.config 中的某个值感到不安,改变了它,然后它似乎起作用了!)
但是现在我有一个同样奇怪的问题! 由于某些原因,它拒绝接受我已配置要发布的元数据。 我的 app.config (主机端)设置如下:
我已尽力弄清楚为什么它会声称元数据未在指定地址“http 发布://localhost:8010/Feeder/mex”。 任何帮助将非常感激。
干杯!
well this problem seems to have resolved itself (suddenly after never complaining before, WCF started getting upset about a certain value in the app.config, changed that and it seemed to work then!)
however now i have an equally strange problem! for somre reason it refuses to accept that i have configured metadata to be published. my app.config (host side) set up is as follows:
I have tried my best to work out why it would be claiming the metadata isn't being published at the specified address "http://localhost:8010/Feeder/mex". any help would be greatly appreciated.
Cheers!
抱歉,经过进一步的搜寻,我发现了错误的根源! 数据契约中的一个类已被更改([DataContract] 属性已被删除,但奇怪的是 [DataMemeber] 已保留在相关属性上!非常奇怪!)
无论如何,感谢您的所有帮助,尤其是 r 让我做到这一点点,我终于可以摆脱这个该死的项目了:-)
sorry guys, after further trawling i discovered the source of the error! one of the classes in the datacontract had been changed (the [DataContract] attribute had been removed, but strangely [DataMemeber] had been left on the relevant properties! very odd!)
thanks for all your help anyways, especially rfor getting me to this point, where i can finally wash my hands of this damn project :-)
WCF 偶尔会出现问题,导致它“无提示”失败(即没有例外),这可能很难调试。 听起来这可能就是您所看到的情况。
在这种情况下,在 WCF 中启用跟踪选项会非常有帮助,因为它应该允许您查看消息是否确实到达服务以及调度程序如何处理它。
There are ocassional problems with WCF that will cause it to fail "silently" (i.e. no exception) which can be hard to debug. Sounds like this might be the case you're seeing.
In this case, enabling the tracing options in WCF can be extremely helpful, as it should allow you to see if the message is indeed reaching the service and how the dispatcher is dealing with it.