Requested Timed Out for a Wcf service.


I am working on website in that i need to call the Web Service Function from the aspx page.The call Function/Web Method is with in for loop(.aspx page).Each iteration of calling the function/webMethod returns a new Random Number or an Auto id number will be generated.But upon continuously calling the Function it returns Requested Time Out Exception How to solve this error i will discuss in this Article.

when i was working this problem I do not know much about wcf services.As the web service is published on some other server.I am calling the function in a for loop say upto 1000 or 2000 times or more than that.At some point of time or generating some numbers 10 or 11 Numbers then wcf service is throwing an error or exception requested timed out.

The Code looks like in the Below...



try
{
for (int i = 0; i < 1000; i++)
{
string strreference = objResponse.SubmitMessage();
Response.Write(strreference);
System.Threading.Thread.Sleep(1000);
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}




In asmx page....



[WebMethod(Description = "Submit Quick SMS. oMesgType (0-English,8-Arabic), MsgDestinations: Comma delimited mobiles, DLREnable: (0 - Disable, 1 - Enable)")]
public string SubmitMessage(string UserName, string Password, string Message, string oMesgType, string SenderID, string MsgDestinations, string DLREnable)
{
string strTransactionID = "";
string strMBC = string.Empty;
try
{

SetLogpath();
WriteToFile(m_strUpLoadPath, "Preparing the xml.", true);
//System.Diagnostics.Debugger.Launch();
if (!SetSMSDetails(UserName, Password, strMBC, SenderID, oMesgType, MsgDestinations, Message, DLREnable.Trim(), ref strTransactionID))
{
WriteToFile(m_strUpLoadPath, "Failed to prepare the xml." + m_strLastError, true);
return m_strLastError;
}
}
catch (Exception ex)
{
WriteToFile(m_strUpLoadPath, "Exception: SubmitMessage\t" + ex.Message, true);
return ex.Message;
}
return strTransactionID;




The Submitmessage() function which is there in the Wcf service Function will return an auto integer and write in the Form with the the help of Response.Write.But I am getting the following exception

i.e. Exception : The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named 'SynapseWsSoap'. This is an invalid value for bindingConfiguration. (C:\Users\Bhushan\Desktop\Bhushan\WebApplication1\WebApplication1\web.config line 161)

See the Real time image of my wcfservice...

Error Message wcf service

I tried several options like increasing the BufferOutputtime and increase of Recieved Timedout in my aspx webconfig file But this error keeps on Coming even the changes made in the Webconfig file.

Suddenly i realize with Number of times reading the exception i thought of changing the Webconfig File in Binding Section.

At the time of Exception My web config configuration was like this..

WCF BINDING CONFIG

But After i edit the webconfig file like this...

New Basic Http

my Exception was gone and look at the Output i got...

Random Numbers

WsHttpBinding vs BasicHttpBinding :



The Main difference between WsHttpBinding and BasicHttpBinding is that Security of Ws HttpBinding is at Transport Level and as well as Message Level where as Basic Http Binding will be only at transport level normal like web service.My assumption for the Requested Time out error/Exception is because the WsHttpBinding scrutinizes more at the transport and Message levels so that it is not able or unable to process the request.hence it is giving a message Timeout requested error.


Attachments

Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 73 articles authored by srirama

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: