Netsuite restlet calls from .Net Api started to give errors - api

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

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.

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

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?

System.Net.WebException when connecting a URL

I have a windows service running every 3 minutes. At the start, this service hits a static URL that which returns "success". We are using WebClient.OpenRead(URL) for getting the result.
This is working fine in most machines. In one particular machine I am getting the following exception:
System.Net.WebException: The underlying connection was closed:
Could not establish trust relationship for the SSL/TLS secure channel. --->
System.Security.Authentication.AuthenticationException:
The remote certificate is invalid according to the validation procedure.
I moved this function alone to a separate exe and it was working fine. But when the same runs as a service, I am getting the mentioned exception. Any help would be much appreciated.

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