Unable to send web request: SocketException - CLR_E_FAIL (1) #1315
Replies: 8 comments 13 replies
-
|
Beta Was this translation helpful? Give feedback.
-
@jasonkaisersmith does your system has the correct date & time set? Are you sure that that root CA is the same as the one at the device you are connecting to? Are you using which fw version and which hardware? |
Beta Was this translation helpful? Give feedback.
-
PS: you can get almost instant reply if you ask your question on our Discord server. 😉 |
Beta Was this translation helpful? Give feedback.
-
The SecureClient_WiFi sample does not throw an exception. But I get "0 Bytes read", I assume that is not expected? (I ran example 1). The HttpWebRequest sample does not work however. I have validated that the date & Time are correct and that the certificate is the right one. HW is ESP32 FW version 1.8.1.307 |
Beta Was this translation helpful? Give feedback.
-
#1313 SocketException - CLR_E_FAIL (1) , fixed in 1.8.1.307 |
Beta Was this translation helpful? Give feedback.
-
If you can check the SSL sample authenticating it confirms that your device is running the correct firmware and that the library is working. |
Beta Was this translation helpful? Give feedback.
-
Guys, this is also happening with firmware 1.9.1.0 trying to send the certs you have built in to the resources for the Basic Azure IoT sample in the samples repo. I'm running the sample unmodified, and just constantly hitting this when trying to do the Azure.Open call: Time/Date is definitely correct as the app is using the built in WiFi connect calls to get/set it. Certs being used are the ones in the runtime resources pool. NuGet & FW versions are definitely a match. Weirdly, if I kill my IoT hub devices, and the IoT hub then recreate it, things will work for a while, but after a time will start going wonky again. Shawty |
Beta Was this translation helpful? Give feedback.
-
Hi @Ellerbach , certainly... (Sorry I did write things in a bit of a rush last night) "I'm running the sample unmodified, and just constantly hitting this when trying to do the Azure.Open call" The code I am running to test this is not my own code, I'm 100% using one of the samples provided in the sample repository (The Azure Basic Sample to be exact), and in testing I have not modified the sample in any way that might cause the code to work incorrectly. The sample errors every time when the "Azure.Open" call is made in the Azure connection method. "Weirdly, if I kill my IoT hub devices, and the IoT hub then recreate it, things will work for a while, but after a time will start going wonky again." When I encounter the error, if I delete the device ID I am trying to connect too, then recreate that device ID , or if I create a brand new device ID within my IoT hub, then run the sample code on my device, it will work perfectly the first time, but if I then stop that code and re-run it, it will fail with the CLR_E_FAIL error. Very occasionally it will run twice in succession (I've actually only got this to happen once) , in most cases it will fail. When it fails, recreating or making new as mentioned works once more, then fails again on subsequent runs. If you would like me to screen capture a demo I can easily do that, no problem. Cheers |
Beta Was this translation helpful? Give feedback.
-
I am trying to send a webrequest to an internal server but am getting the following:
++++ Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ++++
++++ Message:
++++ System.Net.Security.SslNative::SecureConnect [IP: 0000] ++++
++++ System.Net.Security.SslStream::Authenticate [IP: 0054] ++++
++++ System.Net.Security.SslStream::AuthenticateAsClient [IP: 000a] ++++
++++ System.Net.HttpWebRequest::EstablishConnection [IP: 027c] ++++
++++ System.Net.HttpWebRequest::SubmitRequest [IP: 001a] ++++
++++ System.Net.HttpWebRequest::GetRequestStream [IP: 0008] ++++
++++ System.Net.Http.HttpMessageInvoker::Send [IP: 0013] ++++
++++ System.Net.Http.HttpClient::Send [IP: 006f] ++++
++++ System.Net.Http.HttpClient::Post [IP: 0011] ++++
My code:
The exception is then thrown on executing the "post" command.
I suspect that something is wrong with my code, but I can't see what it is.
So, could somebody help me with this?
Beta Was this translation helpful? Give feedback.
All reactions