c# - Unable to get data from a particular WCF Service Operation which is sending files in response -


i have wcf service many methods, 2 of transferring files. 1 working correct, sends 3 files byte array in single row. other 1 sending list of database rows, each row has 1 docx file in it. when wcf client invokes operation, runs on server side , rows fetched database, after sends response, client receives following exception:

an error occurred while receiving http response http://localhost/service/service.svc. due service endpoint binding not using http protocol. due http request context being aborted server (possibly due service shutting down). see server l ogs more details. underlying connection closed: unexpected error occurred on receive.

the minimal code listed below:

[datacontract] public class document {     [datamember]     public int id { get; set; }      [datamember]     public string name { get; set; }      [datamember]     public byte[] file { get; set; }      [datamember]     public int schemaid { get; set; }      [foreignkey("schemaid")]     public virtual schema schema { get; set; } }  [servicecontract] public interface iservice {     [operationcontract]     list<document> getdocuments(int schemaid); }  public class service : iservice, idisposable {     dbcontext db = new dbcontext();     public list<document> getdocuments(int schemaid)     {         list<document> docs = db.documents.where(d => d.schemaid == schemaid).tolist();         return docs;     } }  public partial class serviceclient : system.servicemodel.clientbase<iservice>, iservice {     public document[] getdocuments(int schemaid)     {         return base.channel.getdocuments(schemaid);     } }  try {     serviceclient client = new serviceclient("basichttpbinding_iservice");     client.open();     list<document> docs = client.getdocuments(9).tolist();     client.close(); } catch{} 

in wcf client config file, using default values of basichttpbinding. after received exception, tried increasing maxreceivedmessagesize on binding in client side, still receiving same exception.

please suggest, how can resolve this?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -