The SSL connection could not be established - asp.net

I am using a third party library (MinIo dotnet SDK) in my .NET application. I successfully send the requests on the localhost, but at the time of publish on the IIS server, the requests are met with the following error.
MinIO API responded with message=Connection error:The SSL connection could not be established, see inner exception.. Status code=0, response=The SSL connection could not be established, see inner exception., content=

Same problem here this week.
We had to install the (root) certificate we used for our minio/S3 server on the machine we ran our application on.
If you don't want to use SSL, you have to use MinioClient.WithSsl(false).

Related

Authentication failed because the remote party sent a TLS alert when invoking a 3rd party API

I have a Blazor Server Application that is invoking a 3rd party API using IHttpClientFactory. When I execute the calling code on my local Windows 11 machine I receive the exception below. However, If I run the same code from an Azure Web App, the API is called successfully.
Error: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
System.Security.Authentication.AuthenticationException: Authentication failed because the remote party sent a TLS alert: '112'.
I have attempted setting the Security protocol to TLS1.2 using the ServicePointManager, however, this does not make a difference. I have run Wireshark to glean some additional information, but all I can see is that my machine is initiating the call with TLS 1.2.
Does anyone have an idea as to why my code works in Azure, but not in my local development environment?
According to the behavior in azure web app, I think the issue should related to environment.
And if you have another os version pc, you can test it, and it should be work normally.
And I found the workaround in win11. You can add the registry key and removed the code to set the protocol to TLS1.2, and the TLS handshake worked from your Windows 11 system.

Azure Scheduler Job: SendFailure The underlying connection was closed

I have created Scheduler Job in Azure using HTTPS action to periodically ping ASP.NET Web application deployed on VM. Web application is configured with HTTPS binding using SSL certificate. I have configured IIS security using IIS Crypto 2.0 tool.
Scheduler Job fails with an error:
Http Action - Request to host 'www.somesamplehost.com' failed: SendFailure The
underlying connection was closed: An unexpected error occurred on a
send.
The same URL works fine when I try to access it from any browser.
Screenshot from Azure Portal:
The issue was due to SSL certificate. I have ECC SSL certificate for my Web Application and Azure Scheduler Job does not support making requests to Web Application that has that kind of certificate.
Guys from MS suggested alternative for Scheduler Job. It is a feature in Azure Portal called "Logic Apps". You can set it up in a way that it periodically makes requests to specific URL, but "Logic Apps" has much more capabilities compared to Scheduler Job.

AWS Elasticbeanstalk WebSockets

I deployed an Asp.Net Web API project on Amazon Web Services' Elasticbeanstalk (IIS configured machine). Everything works fine except WebSocket. To test the WebSocket easier I use Simple WebSocket Client extension on Chrome.
When I make a request to the API, I get the following (error) message (I observe this message over developer console's network tab):
WebSocket connection to 'ws://my_url' failed: Error during WebSocket handshake: Unexpected response code: 400
I have not found enough information to overcome this problem.
I tried enabling all Inbound/Outbound TCP connections from all ports and all IPs under Security Groups.
I tried creating an empty Asp.Net Web API project that only has a basic sample of WebSockets (just sending a message to the connected user) and deploying it to a brand new environment and application on AWS.
Nothing has worked so far.
I am using Microsoft's WebSockets, .NET Framework 4.5.1.
What are the possible solution ways?
If you are using AWS Elastic Load Balancer in your elastic beanstalk then ELB does not support web sockets and you have to apply a work around. Change your Load Balancer top classic load balancer that supports Websockets.
https://aws.amazon.com/blogs/aws/new-aws-application-load-balancer/
I solved the problem by adding All TCP on Inbound segment of Security Groups and using the IP address of the server instead of AWS created name.

SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443

I got 2 servers with two equal wcf services hosted on them and one client application server. I can connect to endpoints and send a requests to both services using test wcf client app (.NET Web Service Studio) from my local machine successfully. But when I am trying to connect from client application server using the same test wcf client app I successfully connected only to the one wcf service server, but I have got an error when connecting to another one:
System.Net.WebException: There was an error downloading 'https://XXX/XXX?wsdl'. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443
I performed netstat -an | find "443" command in command prompt on the client server and on my local machine to find out the difference and here what I have got:
1. On my local machine:
2. On the client app server:
What I already tried to do on client application server is:
- turned off firewall;
- stopped windows firewall service
- uninstalled mcafee virusscan enterprise application.
(I tried to set "prevent mass mailing worms from send mail" first, but mcafee was in foreign language that I don't understand, so I just uninstalled it)
after running command netstat -aon | findstr "443" on client application server I have got this result:
but I still got an error.
Does anybody know how to solve this issue?
Could be the problem on the wcf service server side?
The solution was predictable simple one - firewall was blocking the port,
but it's important to notice that the issue was caused by firewall on the wcf service server side, but not on client application server, which is making the request to that service.
I asked the technical support of that server, and they made firewall changes.
After that error was disappeared.
I faced the same issue and tried different ways to fix this. Nothing works. Later i found the issue which is, the application i tried to run is https and in my IIS, https binding was not created. I created binding https with the website and it works.

SoapUI and web service testing with windows authentication

Blockquote
I'm trying to test an already deployed web service through SoapUI. The service URL is https://hostname:82/Service.asmx. I modified the test Endpoint to reflect this. Web requests go through a proxy that uses Windows Authentication.
First I attempted to run the test directly but without success. All I got was an error:
401 - Unauthorized: Access is denied due to invalid credentials
Next, I entered proxy details and domain username/password into SoapUI proxy settings. This creates another error:
status# HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow
SSL requests from this port. Most Web browsers use port 443 for SSL requests. )
I wasn't really paying attention to this until now so I ignored the error and went on to install Burp Suite hoping that this would help with Windows Authentication. I got the Internet working through Burp Suite but soapUI still doesn't do anything and I can't run any tests. This time the error is a bit different:
XML Parsing Error: syntax error Location:
https://hostname:82/Service.asmx Line Number 1, Column 1:Burp proxy
error: failed to connect to IP.
What am I doing wrong? :)
Figured it out in the end. I configured Burp proxy the wrong way. Instead of redirecting to my WS server, I was redirecting to our internet proxy which of course didn't know what to do.

Resources