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

I am running a e-commerce website which will call a remote payment gateway when customer check out. with ASP.NET(2.0)

The Bank Give Me WebService and say to me to use post method for sending my information.

My Transaction State Is Ok But when i call a method of Bank webservice  it give me error  

_______My Sample Code ___________

double TA;
WebServices.ReferencePayment PaymentWebService = new WebServices.ReferencePayment();
string MID = "00229018-45987";
string t_strRefNum="*********";
double t_lAmount;
protected void Page_Load(object sender, EventArgs e)
    {
        t_lAmount = double.Parse(Session["Amount"].ToString());
        t_strRefNum = Request["RefNum"].ToString();
       TA = PaymentWebService.verifyTransaction(t_strRefNum, MID);
/***************************
    }

  

Error  Is :

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: 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

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SocketException (0x274c): 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]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1028066
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetRequestStream() +1532269
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +103
   WebServices.ReferencePayment.verifyTransaction(String String_1, String String_2) +63
   ASP.confirmreservations_aspx.Page_Load(Object sender, EventArgs e) +1024
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
0 ehsh 11/9/2007 11:49:33 AM

Hi Every Body , PLEASE HELP ME ,

I 'm waiting to receiving a answer .

Thank'sssssssssss

0 ehsh 11/11/2007 8:22:33 AM

Hi ehsh ,

From the error message, it is that the bank web service don't response your request, you have to check:

  1. Whether you can visit the bank web service
  2. Whether you have right to visit web service, do you use the certificate or other way provided by bank to verify your right.

If you still can't solve it , I am afraid you have to connect bank service.

Best regards,
Guang-Ming Bian - MSFT


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0 Guang 11/14/2007 7:21:40 AM

Hi, sorry for reactivating this old thread. but were you able to solve your problem?! How please?

 I'm having the very same issues with an IIS7 on Windows Server 2008 setup that won't go outside to fetch any data what so ever...but everything works fine when testing on Visual Studio's 2008 development server (which is installed on the same machine, btw yes I know it's bad practice to mix the production and server machines)...still this is drivin' me crazy.

Also, my machine is behind a proxy server, which is set in Internet Options (I can surf the web using IE on that machine)?!?

 Any ideas?! Any?! Any1? Plz...I'm loosin' my mind Party!!!

0 nubie 8/18/2008 1:09:20 PM

The problem could be that you need to explicitly set the proxy and credentials to the request

                    this._request.Proxy = new WebProxy(proxyServer, proxyPort);
                    this._request.Proxy.Credentials = new NetworkCredential(username, password);

 As in the dev environment it runs under your credentials, whereas when it's in the prod it will use the default IIS settings

0 auschucky 9/23/2008 4:22:19 AM

 As well as this, try including the inpersonate tag in the web.config

0 auschucky 9/23/2008 4:35:42 AM

Actually my friend what you're saying is true in some way, but it's a bad practice, usually It's works for development purpose, but in production you have to use a service user (account) administrated by

Directory Server, so your reply is not valid..

 

What I suggest is check your configurations with the MOM utility, after that use impersonation and windows authentication.

 

Regards

0 drdre_08 10/9/2008 3:40:26 PM

 thanks, buddy. It fixed my issue. I was trying to access a server in our intranet from DMZ.

0 sbilla 3/5/2009 9:59:00 PM
Reply:

(Thread closed)