Umut Derbentoğlu
Umut Derbentoğlu

Reputation: 1196

WCF Timeout Exception Server Side

I have a WCF service with methods that mostly consist of insert operations. Sometimes due to the insert operations take too much time, clients get timeout exception. Is there anyway to catch this timeout exceptions inside WCF service (not client)? Can I log this timeout errors?

Upvotes: 1

Views: 297

Answers (1)

Seymour
Seymour

Reputation: 7067

Rather than relying on the communication timeout to control the length of service operations, you could control the allowable time to insert in the application. To that end, you could change your service method to be asynchronous and specify a maximum time-to-run that is less than the transport timeout.

The example in the MSDN “Cancel Async Tasks after a Period of Time” may be helpful.

Upvotes: 1

Related Questions