-1

I am having an issue trying to deploy a WebApi which makes an outbound Soap call to a Remote System to a IIS Server. 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. No matter from where i deploy the code , from local ore Remote Studio 2019 it always fails on the Server with the following error.

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.

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.

NoSoup4you
  • 640
  • 1
  • 10
  • 34
  • Have you tried setting security protocol to TLS 1.2 before calling this? https://stackoverflow.com/questions/37869135/is-that-possible-to-send-httpwebrequest-using-tls1-2-on-net-4-0-framework – Chaos Apr 02 '20 at 19:45
  • I tried that but with no luck. Just as a side note, to connect to the remote system i need to use a p12 Cert that is secured by password. Could that cause any issues if there was a permission issue with the cert file ? In anycase i do not get an error for it. Also is there a better way to debug this issue like enable some logging for the process that manages the SSL Connection ? – NoSoup4you Apr 02 '20 at 20:25

1 Answers1

-1

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. 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.

enter image description here

NoSoup4you
  • 640
  • 1
  • 10
  • 34
  • Good find. Once you discover the minimum set of permissions required it may be useful to come back and edit your answer, assuming the findings are transferable (e.g., built-in Windows based roles). – Jeremy Caney Apr 03 '20 at 19:13