Click here to Skip to main content
15,907,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
we are sending
C#
JsonConvert.SerializeObject(lstobject);

to the url here lstobject is large list sent to the url.error also returned after 3 minutes to log error hoew to make webrequest to wait 5 minutes


C#
var httpWebRequest = (HttpWebRequest)WebRequest.Create(ConfigurationManager.AppSettings["JsonPayloadPostUrl"].ToString());
            httpWebRequest.Timeout = 1000000;
            httpWebRequest.Method = "POST";
           using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
          {
              streamWriter.Write(jsonPayload);
           }
           var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
          using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
          {
           var responseText = streamReader.ReadToEnd();
          
          }


What I have tried:

we added
C#
httpWebRequest.Timeout = 1000000;

but no use please suggest some solution.to make the request completed
Posted

1 solution

Hello
if you are using web api, it is because you are using more than one function in your controller.
go to App_Start folder in your project, go to WebApiConfig.cs and replace

"api/{controller}/{action}/{id}" instead of
"api/{controller}/{id}"

in front of : routeTemplate
hope it works
 
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