UPS error - connection closed on send


https://forum.kartris.com/Topic6986.aspx
Print Topic | Close Window

By SAbow - Mon 22 Jan 2018
Hi,

Just recently began getting this error in a couple of my Kartris sites... (these are hosted on different servers that all have TLS 1.2 already installed on them)
On front of site, says "no shipping available to your destination", but in the log this is the error I see:
"UPS - Error: The underlying connection was closed: An unexpected error occurred on a send."

the config url was recently updated to "https://onlinetools.ups.com/ups.app/xml/Rate" due to security updates on ups's api calls. And worked fine for a couple of weeks... now this...
Do you think the code for this call is no longer secure enough (TLS 1.2, etc)?

Please look into this issue ASAP.

Thanks,
By mparker - Tue 23 Jan 2018
Try putting this within the Application_Start() sub of the Global.asax. This will force Kartris to use TLS 1.2.

Try
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Catch
End Try
By SAbow - Wed 24 Jan 2018
We added the code that you sent, but it's still throwing the same error.Do we need to change the version of .NET (right now it's using version 4.0.30319)?
Do you have a working site that ships via UPS that we can look at?
By mparker - Thu 25 Jan 2018
Hey - We do have a client running Kartris and is successfully using UPS (I can PM you). We were having issues prior to the code change posted above. That's the only change that I made. Here's a blog post about enabling TLS 1.2: https://blogs.perficient.com/microsoft/2016/04/tsl-1-2-and-net-support/. It looks like the newest version of Kartris also has this change now.
We're running .NET v4.0.30319.18051 on Windows Server 2012. You may need to Google if you need to do anything on a server level. Not sure if one of our sys admins did that prior.


Maybe someone from Kartris could shed some light on this?
By SAbow - Thu 25 Jan 2018
After much digging around we finally found a setting that needed to be turned on - now it works with that code that you sent! Thank you so much!!!
By Paul - Mon 29 Jan 2018
I recall that TLS 1.2 support requires ASP.NET 4.5 or above, which the perficient link above confirms too. I wasn't aware that 4.6 defaults to tls 1.2, but that's good news as it should take care of most installations of older Kartris assuming they're putting on ASP.NET updates.

The environment version numbers for the ASP.NET installations are a little misleading. For example v4.0.30319.42000 looks like it should be ASP.NET 4.0 but it is 4.6.

Microsoft recommends checking the registry to see the .NET version installed:

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

It's a bit of a messy approach. You have to look up DWORD values then look them up in a table to find what .NET version they correspond to.

Microsoft really should have incorporated a simpler way within the app code itself to find what version of .NET it's actually running on, especially as the 4.x branch is very stable now, and code written for 4.5 could be running on 4.5.1, 4.5.2, 4.6, 4.6.1, 4.7, etc. all of which have slight differences and new features which might need to be coded around.
By Paul - Fri 9 Feb 2018
When you say you found a setting, can you clarify where this was? I have another client reporting issues, and the ASP.NET 4.6 setting on its own doesn't seem to address it. Was the setting a kartris one, or somewhere on Windows?
By SAbow - Mon 12 Feb 2018
The setting that we needed to change was a bit embarrassing actually - I didn't realize that someone had made UPS inactive when this error started coming up, so after

(1) Adding this code to the Application_Start function of global.asax
Try
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Catch
End Try

(2) In the backend (Configuration > Payment and Shipping Gateways): changing the UPS URL to https://onlinetools.ups.com/ups.app/xml/Rate



all I needed to do was turn UPS back on.