本帖最后由 u010285033 于 2014-12-19 09:38:07 编辑

解决方案 »

  1.   

    服务器TimeOut了,可能是端口限制的原因或防火墙
      

  2.   


          ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
      X509Certificate x509 = new X509Certificate(cert,password);
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        request.KeepAlive = false;
                    request.ClientCertificates.Add(x509);
      var encoding = System.Text.Encoding.UTF8;
                    byte[] databyte = encoding.GetBytes(xml);
                    request.Method = "post";
       using (Stream responstream = request.GetRequestStream())
                    {
                        responstream.Write(databyte, 0, databyte.Length);
                        responstream.Close();
                    }               
                         HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                 
                  
      

  3.   


          ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
      X509Certificate x509 = new X509Certificate(cert,password);
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        request.KeepAlive = false;
                    request.ClientCertificates.Add(x509);
      var encoding = System.Text.Encoding.UTF8;
                    byte[] databyte = encoding.GetBytes(xml);
                    request.Method = "post";
       using (Stream responstream = request.GetRequestStream())
                    {
                        responstream.Write(databyte, 0, databyte.Length);
                        responstream.Close();
                    }               
               HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                 
                  

    在      HttpWebResponse response = request.GetResponse() as HttpWebResponse;这里报出的异常.基础连接已经关闭: 连接被意外关闭。
      

  4.   

    还用了https
    你先确认下在服务器上能打开网址不?
      

  5.   

    https://api.mch.weixin.qq.com/secapi/pay/refund
    在浏览器直接打开提示 使用post请求
    用fiddler打开是504