2016-01-22 10 views
34

यह एक सप्ताह से पहले अच्छी तरह से काम कर रहा था लेकिन अब यह निम्न त्रुटि दिखाता है। मैंने निम्नलिखित चीजों की कोशिश की है लेकिन इसका कोई उपयोग नहीं है।अनुरोध निरस्त कर दिया गया था: एसएसएल/टीएलएस सुरक्षित चैनल सैंडबॉक्स खाता नहीं बना सका

ServicePointManager.Expect100Continue = true; 
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; 

तो मेरे संभव समाधान के साथ सुझाव है

public string HttpCall(string NvpRequest) //CallNvpServer 
    { 
     string url = pendpointurl; 

     //To Add the credentials from the profile 
     string strPost = NvpRequest + "&" + buildCredentialsNVPString(); 
     strPost = strPost + "&BUTTONSOURCE=" + HttpUtility.UrlEncode(BNCode); 

     ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; 
     // allows for validation of SSL conversations 
     ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 


     HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); 
     objRequest.Timeout = Timeout; 
     objRequest.Method = "POST"; 
     objRequest.ContentLength = strPost.Length; 

     try 
     { 
      using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream())) 
      { 
       myWriter.Write(strPost); 
      } 
     } 
     catch (Exception e) 
     { 
      /* 
      if (log.IsFatalEnabled) 
      { 
       log.Fatal(e.Message, this); 
      }*/ 
     } 

     //Retrieve the Response returned from the NVP API call to PayPal 
     HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); 
     string result; 
     using (StreamReader sr = new StreamReader(objResponse.GetResponseStream())) 
     { 
      result = sr.ReadToEnd(); 
     } 

     //Logging the response of the transaction 
     /* if (log.IsInfoEnabled) 
     { 
      log.Info("Result :" + 
         " Elapsed Time : " + (DateTime.Now - startDate).Milliseconds + " ms" + 
         result); 
     } 
     */ 
     return result; 
    } 
+0

इस पर कोई अद्यतन? मुझे भी एक ही समस्या का सामना करना पड़ रहा है। – Saurabh

उत्तर

35

मैं बस अपना परीक्षण वातावरण में यह एक ही समस्या के रूप में अच्छी तरह से (सौभाग्य से मेरे लाइव भुगतान के माध्यम से जा रहे हैं) में भाग गया। मैं बदलकर तय:

public PayPalAPI(string specialAccount = "") 
{ 
    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls; 

public PayPalAPI(string specialAccount = "") 
{ 
    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; 

को वे SSL3 के लिए विकलांग समर्थन थोड़ी देर पहले: https://www.paypal.com/uk/webapps/mpp/ssl-security-update, विशेष रूप से बताते हुए

आप सुनिश्चित करें TLS 1.0 का उपयोग कर पेपैल अंतिम बिंदुओं को कनेक्ट कर रहे हैं या 1.2 (वर्तमान में सभी एपीआई एंडपॉइंट्स टीएलएस 1.1 का समर्थन नहीं करते हैं)।

उनके latest update (@awesome से टिप्पणी अद्यतन के लिए THX) में कहा गया:

पेपैल सभी HTTPS कनेक्शन के लिए TLS 1.2 की आवश्यकता होती है को अपनी सेवाएं अपडेट कर रहा है। इस समय, पेपैल भी HTTP की आवश्यकता होगी/सभी कनेक्शन के लिए 1.1 ... सेवा के किसी भी व्यवधान से बचने के लिए, आपको सत्यापित करना होगा कि आपके सिस्टम 17 जून तक इस बदलाव के लिए तैयार कर रहे हैं, 2016

+1

आधिकारिक समाचार https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US –

+0

धन्यवाद ढेर! मुझे जिस चीज की जरूरत थी। – Brendan

22

दरअसल बदल रहा है सुरक्षाप्रोटोकॉल टाइप करें। टीएस समस्या को हल करता है, यदि आप 4.5 से कम फ्रेमवर्क के साथ वीएस में काम कर रहे हैं तो आप इसे बदलने में सक्षम नहीं होंगे, आपको बदलने के लिए अपने वीएस को उच्चतम संस्करण 2012/2013/2015 में अपग्रेड करना होगा यह।

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType। टीएलएस 12;

+27

दरअसल आप * इसका उपयोग कर सकते हैं (कम से कम 4.0 में) इस तरह: 'सेवापॉइंट प्रबंधक। सुरक्षा प्रोट्रोकॉल = (सुरक्षाप्रोटोकॉल टाइप) 3072; // SecurityProtocolType.Tls12' –

+0

@ जेम्स मैककॉर्मैक: बहुत अच्छा धन्यवाद, एक अपवित्र है। –

+0

यह बहुत उपयोगी है @JamesMcCormack – scgough

7

अपने वैश्विक.एक्सएक्स में निम्नलिखित कोड जोड़ें या (HttpWebRequest) WebRequest.Create (url) को कॉल करने से पहले;

protected void Application_Start() 
{ 
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 
    // ... 
} 

इस वजह से क्योंकि पेपैल के बजाय टीएलएस एसएसएल के लिए अपने एन्क्रिप्शन बदल रहे हैं किया गया था। यह पहले से ही सैंडबॉक्स वातावरण पर अपडेट किया गया है लेकिन अभी तक लाइव पर नहीं है।

और अधिक पढ़ें: https://devblog.paypal.com/upcoming-security-changes-notice/

संबंधित मुद्दे

 संबंधित मुद्दे