本帖最后由 jdayan 于 2011-05-13 17:55:18 编辑

解决方案 »

  1.   

    异常很简单:
    {"Unable to connect to the remote server"}{"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 202.40.243.120:443"}
      

  2.   


       sendUrl=https://smsgw.saasconnect.com/obh/SendSMSLegacyBC就是这个地址!
      

  3.   

    完全没有人来帮忙解决一下吗??
    我修改了代码如下,还是不行   string SenSMSUrl = sendUrl;
                byte[] bytes = Encoding.UTF8.GetBytes(SendSMSOnBehalfReq.InnerXml.ToString());            HttpWebRequest request;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
                request = WebRequest.Create(SenSMSUrl) as HttpWebRequest;
                request.ProtocolVersion = HttpVersion.Version10;            request.Method = "POST";
                request.ContentLength = bytes.Length;
                //request.ContentType = "application/x-www-form-urlencoded";
                request.Timeout = 50000;
                request.KeepAlive = true;
                request.ContentType = "text/xml";
                request.ServicePoint.Expect100Continue = false;            Stream requestStream;
                try
                {
                    requestStream = request.GetRequestStream();
                    requestStream.Write(bytes, 0, bytes.Length);
                    requestStream.Close();
                }
                catch (Exception)
                {                throw;
                }            // using (Stream requestStream = request.GetRequestStream())
                //  {            //  }
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();            if (response.StatusCode != HttpStatusCode.OK)
                {
                    string message = String.Format("POST failed. Received HTTP {0}", response.StatusCode);
                    throw new ApplicationException(message);
                } private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
            {
                return true;
            }
      

  4.   

    ServicePointManager.CheckCertificateRevocationList = false;
      

  5.   

    另外,你这个是不是应该用 GET 呀
      

  6.   

    换成   request.Method = "GET";  ServicePointManager.CheckCertificateRevocationList = false;之后报错
    {"Cannot send a content-body with this verb-type."}还是不行呀
      

  7.   

    对了、干嘛要用“GET”方法呢?
      

  8.   

    没有,我以为你是第一次登录。没看到你往Request有写流,那还用POST吧。