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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s