WCF Exception Analysis

Source: Internet
Author: User

WCF's code instances are all over the web, but there's always a lot of problems in the actual use, and I'll summarize the problems I've encountered using WCF in my project:

(Note: To see the server-side true exception configuration includeexceptiondetailinfaults= "true")

One. Phenomenon: The interface of suspended animation does not throw any exceptions (in common sense over the wait time should throw out the timeout exception but did not throw the unknown reason) or throw timeout exception.

Code environment: Winform+nettcpbinding.

Cause analysis: Because both nettcpbinding and Wshttpbinding are stateful connections, this behavior may be due to the lack of timely release of resources or the number of current sessions exceeding the MaxConcurrentSessions configuration section configuration. BasicHttpBinding is a stateless connection so this problem does not exist

Solution: Timely release of resources, increase the number of maxconcurrentsessions configuration

Two. Phenomenon: Timeout exception.

Code Environment: Winform+nettcpbinding

Cause Analysis: There are many reasons for this phenomenon 1. The acceptance information length exceeds the number of MaxReceivedMessageSize configuration section configurations. 2. Returns the array length exceeds the number of Maxarraylength configuration section configurations. 3. The number of bytes returned exceeds the Maxbytesperread configuration section configuration. 4. The return string length exceeds the number of Maxstringcontentlength configuration section configurations. 5. The number of characters that get the table name exceeds the number of Maxnametablecharcount configuration section configurations.

6. The number of items that can be serialized exceeds the number of Maxitemsinobjectgraph configuration section configurations. For example, you want to return or accept a 10-t,t containing 5 attributes (base types) or a dataset with 10 rows of 5 columns, each with 50 entries. If you do not increase the number of configurations for the Maxitemsinobjectgraph configuration section it is easy to get this error when returning to a larger list, and of course you should use a paging or batch return list to avoid passing too large a list

Solution: According to the actual situation to set the appropriate configuration section, or the use of continuous transmission, paging and other reasonable means to avoid the overrun

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.