Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a WCF service like:

C#
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "SelectQueryResult")]
string GetSelectQueryResult(ClsPagingInfo objClsPagingInfo);


And I consuming it in a MVC project like:

C#
objClsPagingInfo.iPageSize = Convert.ToInt32(PageSize);
                   objClsPagingInfo.iCurrentPageIndex = Convert.ToInt32(CurrentPageIndex);
                   objClsPagingInfo.iPageCount = 1000;
                   objClsPagingInfo.sQuery = txtQuery.Trim();

                   DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ClsPagingInfo));
                   MemoryStream ms = new MemoryStream();
                   ser.WriteObject(ms, objClsPagingInfo);
                   string data = Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length);

                   WebClient webClientNewTicket = new WebClient();
                   webClientNewTicket.Headers["Content-type"] = "application/json";
                   webClientNewTicket.Encoding = Encoding.UTF8;
                   string sResultData = webClientNewTicket.UploadString("http://localhost:50750/TnsEspService.svc/SelectQueryResult", "POST", data);

                   sResultDataReturn = JsonConvert.DeserializeObject<string>(sResultData);
                   DataTable ResultDataTable = (DataTable)JsonConvert.DeserializeObject(sResultDataReturn, (typeof(DataTable)));

                   ViewBag.DataTableTest = ResultDataTable;


It works fine when WCF returns small data but when WCF returns a huge data then It through "Timeout error".

Please suggest some solution for this issue.

Thank you,
Posted
Updated 11-Jun-16 11:11am

1 solution

setting a higher receive timeout could be a solution

Configuring Timeout Values on a Binding[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900