开发者

Can I use a wcf proxy after I get a TimeoutException?

开发者 https://www.devze.com 2023-03-10 15:22 出处:网络
The proxy isn\'t faulted after a timeo开发者_开发问答utexception, and i can still use it. Is it recommended to use that proxy or should i abort it and create a new one?I would say bin it. One of the p

The proxy isn't faulted after a timeo开发者_开发问答utexception, and i can still use it.

Is it recommended to use that proxy or should i abort it and create a new one?


I would say bin it. One of the particular problems with a timeout is that you don't know what happened at the other end, since your client gave up listening. If you have a stateful connection, all bets are now off.

If you are stateless, you can probably get away with it. In either event, you might way to validate the current status if you timed out while performing an operation that affects data. If you were just querying data things are simpler.


Why should we ever reuse a proxy instance?

Creating a proxy is not an expensive operation. Nothing is really done until you make a request to the service.

Besides reusing it means checking for faulted state of it every time before making another request.

If you have a sign in/out architecture you could as well cache the token that is returned after sign in and use it for subsequent requests.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号