My function in service look like this:
public List<X> GetAll(string num)
{
TheContext Mycontext = new TheContext();
IEnumerable<X> MyIEnumerable =
((IObjectContextAdapter)Mycontext)
.ObjectContext.ExecuteStoreQuery<X>("select * from dbo.XXX where y='"+num+"'");
List<X> MyList = MyIEnumerable.ToList();
return MyList;
}
Here the list OK.
My client look like this:
static void Main(string[] args)
{
MyClient proxy = new MyClient ();
List<X> MyClientList = proxy.GetAll("980").ToList();
proxy.Close();
Console.ReadLine();
}
Here have error:
An error occurred while receiving the HTTP response. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
If i return from the function like this this work:
public List<X> GetAll(string num)
{
List<x> MyList= new List<x>();
MyList.Add(new X(){...});
MyList.Add(new X(){...});
MyList.Add(new X(){...});
return MyList;
}
Do you really use
objecttype in the method signature?You should check if the return type is
Serializableand marked withDataContractattribute.Probably that’s the problem.