[英]How do i fix the Could not create SSL/TLS secure channel Error in ASP.NET
I am having an issue trying to deploy a WebApi which makes an outbound Soap call to a Remote System to a IIS Server.我在尝试部署 WebApi 时遇到问题,该 WebApi 向远程系统发出出站 Soap 调用到 IIS 服务器。 I can run my Code on my Workstation with no problems but when i deploy to Server it fails.
我可以毫无问题地在我的工作站上运行我的代码,但是当我部署到服务器时它失败了。 I even went so far to install visual Studio to my Server and run the code in Studio and it also works fine.
我什至将 Visual Studio 安装到我的服务器并在 Studio 中运行代码,它也运行良好。 No matter from where i deploy the code , from local ore Remote Studio 2019 it always fails on the Server with the following error.
无论我从哪里部署代码,从本地 ore Remote Studio 2019 它总是在服务器上失败并出现以下错误。
The request was aborted: Could not create SSL/TLS secure channel
Below is the function i call to make the request which causes the error and throws a webexception.下面是我调用的函数来发出导致错误并抛出 web 异常的请求。
Try
Dim log As New logger
Dim aTTADDRVALRESP As ATT_ADDR_VAL_RESP = Nothing
Dim timeSpan As System.TimeSpan
Dim now As System.DateTime = System.DateTime.Now
Dim startTime As System.DateTime = Conversions.ToDate(Now.ToString("HH:mm:ss.fff"))
Try
Dim results() As Object = Me.Invoke("submitAddVal", New Object() {ATT_ADDR_VAL_REQ})
Dim myCodes As XmlHelper.AttResponseCode = New XmlHelper.AttResponseCode()
myCodes = XmlHelper.GetAttResponseCodes(XmlHelper.DebugXML(results(0)))
System.Diagnostics.Debug.WriteLine(myCodes.ToString)
now = System.DateTime.Now
Dim [date] As System.DateTime = Conversions.ToDate(now.ToString("HH:mm:ss.fff"))
timeSpan = [date].Subtract(startTime)
Dim totalMilliseconds As Double = timeSpan.TotalMilliseconds
aTTADDRVALRESP = DirectCast(results(0), ATT_ADDR_VAL_RESP)
Catch soapException1 As System.Web.Services.Protocols.SoapException
Dim soapException As System.Web.Services.Protocols.SoapException = soapException1
log.writeLog("ADDRVAL_SOAPHTTPBinding", "97", SoapException.Detail)
Catch webException As System.Net.WebException
Dim ex As System.Net.WebException = webException
log.writeLog("ADDRVAL_SOAPHTTPBinding", "108", ex.Message)
End Try
Return aTTADDRVALRESP
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex)
Dim log As New logger
log.writeLog("ADDRVAL_SOAPHTTPBinding", "113", ex)
End Try
So the question, anyone have an idea what would cause this, how to fix or troubleshoot this issue.所以问题是,任何人都知道是什么导致了这个问题,如何解决或解决这个问题。
After some time digging around we figured out the issue.经过一段时间的挖掘,我们找到了问题所在。 As my app uses a certificate file to communicate with the remote system it ended up to be the culprit.
由于我的应用程序使用证书文件与远程系统进行通信,因此它最终成为罪魁祸首。 Even so the File was accessible from code the default pool account did not have enough permission.
即使这样可以从代码访问文件,默认池帐户没有足够的权限。 Originally i gave full read and writes to the everyone group for the file which was not sufficient.The Identity by default is ApplicationPoolIdenty.
最初我对文件的每个人组进行了完整的读取和写入,这还不够。默认情况下,身份是 ApplicationPoolIdenty。 Once i changed it to LocalSystem it worked so Now i can play around with Account permission knowing that's the source of the issue.
一旦我将其更改为 LocalSystem 它就可以工作了,所以现在我可以使用帐户权限进行操作,知道这是问题的根源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.