I am having a problem with my WCF service. Here
[OperationContract]
[WebGet(UriTemplate = "/needs", ResponseFormat = WebMessageFormat.Json)]
List<CustomerNeed> getAllCustomerNeeds();
When I go to the page calling this service, I got this error
GET http://localhost:666/rest/Service1.svc/needs net::ERR_CONNECTION_RESET
When I try to return a string instead of List, it works.
CustomerNeed is a class generated from my database through EntityFramework.
In my service, I call another method, which is in another class;
public List<CustomerNeed> getAllCustomerNeeds()
{
var needs = from cn in db.CustomerNeeds
select cn;
List<CustomerNeed> list = new List<CustomerNeed>();
foreach (CustomerNeed cusN in needs)
{
list.Add(cusN);
}
return list;
}
Maybe this is because I have a foreign key in my CustomerNeed table?
When I do LINQ to entity to import my database, do I need to import tables created due to many, many relationships?
source
share