Custom WCF Binding Suppresses Fault

[亡魂溺海] 提交于 2019-12-11 12:03:15

问题


I have a WCF Service which I am calling asychronously.

If I call a method that throws a normal .Net Exception (i.e., not a FaultException) using wsHttpBinding, my WCF Channel is left in a faulted state - this is the expected behavior.

However, if I call the same method using a custom binding:

<customBinding>
   <binding name="httpCompressed" sendTimeout="00:10:00" receiveTimeout="00:10:00">
      <httpTransport maxBufferSize="2147483647"
            maxBufferPoolSize="524288"
            maxReceivedMessageSize="2147483647" />
   </binding>
</customBinding>

Then, while I do receive an exception back, the channel is left in an Open state. This is not an expected behavior - at least, not as far as I can tell.

Is this indicative of a bug in the customBinding for WCF? Is this actually an expected behavior (if so, a pointer documentation would be excellent).

Thanks in advance for any assistance.

David Mullin IMA Technologies


回答1:


This is expexted. WsHttpBinding in default setting (with security session) uses PerSession instancing. It means that single service instance handles all requests from proxy opening the channel. If unhandled exception occures the service instance is destroyed and channel is faulted. Proxy can't open more than one channel and can't start another session so the only thing you can do with faulted proxy is to abort it.

Your custom binding uses pure http transport without any session. Due to that PerCall instancing is used. It means that each request from proxy is handled by new service instance. Service instance is released after each call and faults don't affect the channel because next call will be handled by a new service instance.



来源:https://stackoverflow.com/questions/3611395/custom-wcf-binding-suppresses-fault

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!