WCF Rest ERR_CONNECTION_RESET not a big answer
The error code is absolutely horrible, ERR_CONNECTION_RESET has many reasons, and the reasons I found on other questions were because the MaxRequestLength was too small for large web service calls. The data I was returning was only a couple of kB, so this couldn't be a problem.
Here is my interface code
[WebGet(RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "GetReportByID?ReportID={ReportID}")]
[OperationContract]
UsageReport GetReportByID(int ReportID);
It was implementation
public UsageReport GetReportByID(int ReportID)
{
return new UsageReport(ReportID);
}
And that was the class code for UsageReport
[DataContract]
public class UsageReport
{
[DataMember]
List<UsageItem> RL;
public UsageReport(int reportID)
{
RL = new List<UsageItem>();
using (SqlDataReader dr = DBUtility.ExecuteReader(cmd, "DBString"))
{
while (dr.Read())
{
ItemNumber = dr["ItemID"] as int? ?? 0;
RL.Add(new UsageItem(ItemNumber));
}
dr.Close();
}
}
public class UsageItem
{
int ItemNumber;
public UsageItem(int ItemNumber)
{
this.ItemNumber = ItemNumber;
}
}
+3
source to share