The underlying connection was closed: The connection was closed unexpectedly

Error: “The underlying connection was closed: The connection was closed unexpectedly”

Keyword: c#, asp.net, WCF, service, datatable, return

Scenario: OperationContract defined in service which was returning DataTable as its return Type

Solution: Give your Table a name.

DataTable dt = new DataTable(“name”) or

DataTable dt = new DataTable();
dt.TableName = “name”;

Leave a Comment

Your email address will not be published. Required fields are marked *