Click here to Skip to main content
16,016,489 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
When I call web service from service side and return string response using post method I get an error. I create:
C#
//1) 
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

//2) 
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postParameters.Length;
request.Method = method;

//3) 
StreamWriter stOut = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);

and at 3rd position I got error:
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 116.66.162.16:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at clsWebService.FetchesWebPageUsingHttpRequest(StringDictionary sd, String url, String method)
   at clsCostSavingSimpleCalculator.CheckLogin()

Please help me how to solve this problem
thanks
------
Posted
Updated 13-Jun-11 23:52pm
v2

1 solution

XML
Add following Tags in web.config in <webServices>



            <protocols>
                <clear/>
                <add name="HttpGet"/>
                <add name="HttpPost"/>
                <add name="HttpSoap12"/>
                <add name="HttpSoap"/>
                <add name="HttpPostLocalhost"/>
                <add name="Documentation"/>
            </protocols>
 
Share this answer
 
Comments
rakeshpatil1234 16-Jun-11 2:09am    
thanks for help
but still same error....
it works on my local server but when i upload on client server then this error is occurred

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