PayPal IPN使用TLS 1.1和1.2的Server 2008 SP2失败

时间:2016-03-31 21:21:11

标签: .net vb.net paypal paypal-ipn servicepointmanager

这是我的代码

Dim strSandbox As String = "https://www.sandbox.paypal.com/cgi-bin/webscr"

'.net 4.0
ServicePointManager.SecurityProtocol = DirectCast(3072, SecurityProtocolType)

Dim req As HttpWebRequest = CType(WebRequest.Create(strSandbox), HttpWebRequest)
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
Dim strRequest As String = Encoding.ASCII.GetString(Param)
strRequest = strRequest + "&cmd=_notify-validate"
req.ContentLength = strRequest.Length

Dim streamOut As StreamWriter = New StreamWriter(req.GetRequestStream(), Encoding.ASCII)

这是我得到的错误(第47行是上面代码中的最后一个)

Exception type: WebException 
Exception message: The underlying connection was closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at ProcessIPN.Page_Load(Object sender, EventArgs e) in ProcessIPN.aspx.vb:line 47
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The client and server cannot communicate, because they do not possess a common algorithm
at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)
at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)
at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.TlsStream.CallProcessAuthentication(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)

我在服务器上安装了.net 4.5,我使用VB(我知道) 我已经尝试使用我在这里找到的.net 4.5的其他SecurityProtocol字符串,但是我没有工作要么我已经从C#翻译了上面的4.0,但不确定它是否正确。我应该说这在2015年12月没有ServicePointManager线路时运行良好 这是我试过的.net 4.5行

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 

0 个答案:

没有答案
相关问题