azure-iot-hub System.IO.IOException: Authentication failed because the remote party has closed the transport stream - azure-iot-hub

C# , Net Framework 4.7.2, I have built a connection to Azure IoT Hub using the provided device SDK's. My application functions as expected when running on a Win 10 OS. When I run my application on Win 7 I receive this exception:
Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: HTTP transport exception ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
With some research I fount that it may be due to the security protocol type, but I did not set the protocol type explicitly like the reference below state:
Authentication failed because remote party has closed the transport stream
What I am using is a SecurityProviderSymmetricKey to build a connection to the DPS.
I also verified that my Win 7 machine had TLS 1.2 enabled, since based on what I have researched it is not enable by default, & I still receive the exception.
What I also found it that the device SDK does not allow you to specify the protocol, & it uses the default of the machine.
https://github.com/Azure/azure-iot-sdk-csharp
https://github.com/Azure/azure-iot-sdk-csharp/blob/master/configure_tls_protocol_version_and_ciphers.md
Any ideas on to why it would be building the connection properly on Win 10 and not Win 7?
Any ideas on changes that need to be made, or how I can troubleshoot this issue further?

Related

Is it possible to use Azure Custom Vision in a VB project?

I'm trying to include CustomVision features in an existing VB.NET application. When I try to call any of the functions to create a project or add tags etc., I get the following HttpRequestException:
System.Net.Http.HttpRequestException: 'An error occurred while sending the request.'
WebException: The underlying connection was closed: An unexpected error occurred on a send.
IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
SocketException: An existing connection was forcibly closed by the remote host
I've been able to successfully connect using a test project in C# so I know my keys and endpoints are correct. Is it possible to use Custom Vision with VB or is it just incompatible?
As soon as you can execute HTTP request from VB, there is no reason that it should not work.
The exception you are facing might be due to network configuration from where you are executing it. Can you add more details / a sample code to reproduce locally?

Unable to add service reference SSL

There was an error downloading '_vti_bin/ListData.svc/$metadata'.
The underlying connection was closed: An unexpected error occurred on a send.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: 'https://dummy.svc'.
An error occurred while making the HTTP request to https://dummy.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
The underlying connection was closed: An unexpected error occurred on a send.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, try building the solution and adding the service reference again.
Gradually, web servers switch to new security protocols and delete security protocols that are not recommended, so this may be the cause of your error. Usually, .net will automatically find common security protocols, but sometimes you need to use ServicePointManager.SecurityProtocol performs display update.You can try the following code to force the latest protocol type.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13;
About SecurityProtocolType.

Read error: ssl=0xc2befd00: I/O error during system call, Connection reset by peer

Used platforms:
Ionic mobile application with IBM MFP8.0 Server.
Configuration:
Mobile Application communicates to the server with public domain via HTTPS protocol. Request flow is passed from Internet to intranet & SSL offloading is done at RP and passed to LB. LB in-front of MFP server.
Problem Statement:
When the Application launched and closed continuously or when i refresh the application the below error occurs,
-- failure: {"status":-1,"responseText":"","responseHeaders":{},"errorMsg":"Read
error: ssl=0xc2befd00: I/O error during system call, Connection reset
by peer","errorCode":"UNEXPECTED_ERROR"}
The issue occurrence is intermittent
What I did:
There is SSL pinning code integrated with the Application
WL.Client.pinTrustedCertificatePublicKey('myCertificate.cer').then(onSuccess,
onFailure);
I tried commenting this piece of code as well never helped.
Any recommendation to fix this issue.

Netsuite restlet calls from .Net Api started to give errors

I am using token based authentication for calling netsuite restlets from my .Net WebAPIs.
It has been working well, but since yesterday I started getting this below error on Netsuite sandbox. I don’t see any code change that could have resulted to this. Can anyone point me to the right direction?
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Probably a TLS issue as their sandbox has removed TLS 1.0/1.1
https://stackoverflow.com/a/46944838/266509
I figure that you probably are looking for a Netsuite / Suitescript specific answer but in-case it helps, the following is a thread on the exception string you are reading:
An existing connection was forcibly closed by the remote host

Cannot obtain Metadata when using WCFTestClient tool

I have a WCF service https://payments.acompany.com/WebBridge10/WebBridge10.svc?.
I can open it in the browser, now I want to test it with WCFTestClient tool. After I add the wsdl path to it, I got:
Error: Cannot obtain Metadata from https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl Metadata contains a reference that cannot be resolved: 'https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl'. An error occurred while making the HTTP request to https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. The underlying connection was closed: An unexpected error occurred on a send. Authentication failed because the remote party has closed the transport stream.HTTP GET Error URI: https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl There was an error downloading 'https://payments.acompany.com/WebBridge10/WebBridge10.svc?wsdl'. The underlying connection was closed: An unexpected error occurred on a send. Authentication failed because the remote party has closed the transport stream.
Also I added the service reference to the Visual Studio project, the node(ValidateBTNandProceePayment) shows a + sign on the left. But the other services are showing a locker icon. See the image below.
Why?
Finally, because it is a https service. We need to set up tls 1.2 in Fiddler. So the solution is download Fiddler and click "Tools"=>"Fiddler options"=>"https".
This question seems to have been self answered already, but for anyone who doesn't want use Fiddler as workaround this solution might be relevant: https://stackoverflow.com/a/53503187/593617