"The underlying connection has been closed: An error occurred on receive" when WCF gets a data object

Source: Internet
Author: User

Today, when using WCF to return an object, an error was encountered: The underlying connection was closed: An error occurred while receiving. After a large half-day of the investigation, turned out to be a humble thing in mischief:

This. Configuration.proxycreationenabled = true;

It is true in the above code that causes the program to error, and then it resolves the problem by changing the true to False.

Microsoft's official explanation for proxycreationenabled is that even using this flag to create a proxy will only set up a proxy for the actual type that conforms to the requirements of the acting proxy. Therefore, it may be because my serialized object does not conform to the proxy requirements. Therefore, the speculation may be because my serialization object does not meet the requirements of the proxy, the specific reasons for future re-check.

Throughout the troubleshooting process, through the online information also learned that the following conditions will also be reported this error:

1. The object that needs to be serialized uses an enumeration type, and the enumeration type is not set [DataContract] or the enumeration value itself is not set [Enummember].

2. When the return type is DataTable, the TableName property is not set.

These two questions can be described in the following: Wuhuacong (Wu Huacong) column


"The underlying connection has been closed: An error occurred on receive" when WCF gets a data object

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.