Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This error is coming while im trying to connect to a sharepoint web service through vpn.
______________________________________________________________________________________
System.Net.WebException : Unable to connect to remote Server ---> System.net.Socket.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 203.XXX.XXX.X71:443

at System.net.socket.Socket.DoConnect(EndPoint endPointSnapshot, SpcketAddress socketAddress)

at System.Net.ServicePoint.ConnectSocketInyernal(Boolean connectSocketState state s4, Socket s6, Socket & socket, IPAdress & address, ConnectSocketState state, IAsynchResult asu=yncResult, Exception exception)
______________________________________________________________________________________


Every thing is working in my web browser i m able to get the json data in browser when pasting the url in the browser after login but by the wpf application i m unable to connect and get Data

This is the Code i have used for connecting to the Remote Server to get the jason data through Vpn. also the VPN is SSL Secure


C#
Uri serviceUri = new Uri("https://vpn.xxxxxxxxx.com/_vti_bin/xxxxxxxxxxxx.svc/");
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(serviceUri);
string username = "XXXXXXXXXX";
string password = "XXXXXXXXXX";
wr.Proxy = new WebProxy("XXX.XXX.XXX.XXX:443", true);
wr.Proxy.Credentials = new NetworkCredential(username, password);
wr.Method = "GET";
wr.ContentType = "application/json; charset=utf-8";
wr.Credentials = new  NetworkCredential(username, password);
HttpWebResponse response = (HttpWebResponse)wr.GetResponse();
Stream r_stream = response.GetResponseStream();
StreamReader response_stream = new StreamReader(r_stream, System.Text.Encoding.GetEncoding("utf-8"));
string jSon = response_stream.ReadToEnd();
response_stream.Close();
System.Web.Script.Serialization.JavaScriptSerializer jsSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
RootObject result = jsSerializer.Deserialize<RootObject>(jSon);<pre>



So, what sould i do to fetch the data..????
Posted
Comments
Praveen Kumar Upadhyay 8-Dec-14 4:38am    
Try to increase the timeout value.
SushantVerma 8-Dec-14 7:50am    
No, Its not working
vishnushanmughan 19-Dec-14 5:03am    
I am facing the same problem here in my server ,but the code works perfectly on Local machine

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