I have had an integration problem when hosting my web application in production, and an unanswered support ticket with SendGrid that was created 5 days prior (at the time of writing this). 1&1 have assured me that all ports are open.
My SendGrid Email API (v3) is working perfectly well in development and when I deploy to a site on my network - I have been using an implementation similar to this: https://app.sendgrid.com/guide/integrate/langs/csharp.
When I deploy to my 1&1 Ionos webspace and test I receive the following error:
System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
I am starting to despair as this has caused something of a road block on a project of mine.
[EDIT]
I have just tried a httprequest using a different API and I get the same error. So it must be a server problem with 1&1, but what do I tell them?
I proved the problem was with 1&1, not SendGrid, by testing with another API and getting the same error.
Turns out 1&1 hosting uses a proxy server and I need to amend my SendGrid integration to use a web proxy.
I discovered this:
http://tutorials.moedesign.de/blog/proxy-on-ionos-11-webhosting/
which led me to this help provided by 1&1:
https://www.ionos.co.uk/help/hosting/net/script-examples-for-establishing-external-http-connections-windows/
Quite why they couldn't inform me of this when I rang for support is beyond me.
Related
I have a .NET5.0 standalone service (which is installed as a windows service) which starts a basic SignalR hub. It uses Http.Sys internally has some other API controllers, and I'm currently connecting to it from a WinForms client using HubConnection.
It works perfectly on my development machine, but when I move it into an Azure VM (server 2019 datacentre) the first WebSocket call from the client hangs for a while, then fails. It then seems to "work" from then on, but very, very slowly (too slow to use).
I have opened the appropriate ports incoming and outgoing on the Azure server, and in Azure portal.
If I run my Winforms client on a different azure VM in the same virtual network, it all works fine. Therefore, I am sure the server works correctly, it only fails when I come in over the internet.
The server logfile shows this when I try to connect externally:
2021-11-24
17:10:19.6884|1|DEBUG|Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher|Received
hub invocation: InvocationMessage { InvocationId: "1", Target:
"GetAllState", Arguments: [ ], StreamIds: [ ] }.
17:10:31.1564|4|DEBUG|Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport|Waiting
for the application to finish sending data. 2021-11-24
17:10:31.1564|12|DEBUG|Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport|Error
writing frame. System.Threading.Tasks.TaskCanceledException: A task
was canceled. at
System.Net.WebSockets.ManagedWebSocket.SendFrameFallbackAsync(MessageOpcode
opcode, Boolean endOfMessage, ReadOnlyMemory1 payloadBuffer, CancellationToken cancellationToken) at System.Net.WebSockets.WebSocketExtensions.SendMultiSegmentAsync(WebSocket webSocket, ReadOnlySequence1 buffer, WebSocketMessageType
webSocketMessageType, CancellationToken cancellationToken) at
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsServerTransport.StartSending(WebSocket
socket) 2021-11-24
17:10:31.1564|2|DEBUG|Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport|Socket
closed.
The client shows this:
2021-11-24
18:55:43.4679|50|ERROR|Microsoft.AspNetCore.SignalR.Client.HubConnection|The server connection was terminated with an error.
System.Net.WebSockets.WebSocketException (0x80004005): The remote
party closed the WebSocket connection without completing the close
handshake. ---> 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 (10054): An
existing connection was forcibly closed by the remote host.
I have looked at so many articles trying to fix this but I can't find anything relevant. It must be config-related, and it must be at "azure portal" level because the service works across the LAN. Does anyone have any idea what I need to do to get this running?
Update:
I created a couple of console apps using TcpListener and TcpClient on a new custom port, ran the server app on my Azure VM, connected to it successfully across the internet, and passed messages between the two. Very confused as to why the WebSocket fails to work over the internet.
Update2:
I changed the service to use Kestrel and it now works as expected. So, for whatever reason it refuses to work over the internet using Http.Sys. I was only using Http.Sys to have basic auth for some other clients that won't be using this service so Kestrel will work fine.
I changed the service to use Kestrel and it now works as expected. So, for whatever reason it refuses to work over the internet using Http.Sys.
I have created a very simple web API in C# and there is only one Get method. It's working fine from Visual Studio and IIS. But when I was trying to call it from client machine I was getting error XXX took too long to respond. Search google for XXX 8081 webAPI Get ERR_CONNECTION_TIMED_OUT. I have enabled CORS, increased time out and tried several other steps from StackOverflow. When I checked with fiddler I got below error: [Fiddler] The connection to 'xxx.xxx.com' failed. Error: TimedOut (0x274c). System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.209.10.72:8081.
I found out that I need to open a 8081 port from windows firewall on the server. I opened inbound rule for port 8081 and it resolved the issue. After that I was able to make webapi call from any client machine.
I have HttpWebRequest and its giving this error.I cannot try this answer because i cannot use local ip.There is a strange issue that in my computer there is no error like this but in the server its giving this error.The database is not in server we are using an api for crud operations.By the way the project is windows service. Its giving this error and then the service is stopping.there is another detail.The server where i install the windows service (its is not a server that has th database.) has %100 cpu usage and almost %100 ram usage.I set the timetout of request 100 seconds but it is not solve the problem.The detailed answer as below
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond....
How can i solve this ? And idea? By the way about 50 seconds program trying to post request and then giving the error.Also there is another detail the database owner api has get methods that lists some data i can open them from browser with same link that i used in post
The Problem is about proxy settings of httpwebrequest. Setting a proxy solved this.
Created .net custom tcp server and client using tcplistener. Taks is simple to exchange the data. I have Windows server, on which I am able to communicate. Within network also I am able to communicate. When I deploy this same on our web server, public IP is not accepting connections. At client side it throws time out error:
A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond .....
Trace route shows request is going there till server and at the end its not showing time out. Server is VM on azure.
Add the endpoint to the Azure configuration:
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/
Thanks for your help. It was firewall issue. It is resolved but I am clueless about the problem. Firewall ports opened earlier did not worked. so I stopped firewall and I found its working. later on I started and firewall it again worked. strange....fire wall is not updated it seems.
Thanks.
Kishor
I have a Visual Studio application which makes heavy use of WCF services. Normally, the team can just download the app from SVN and run and it uses proxy settings from IE and everything is fine.
A new member of the team has just tried to do the same and as soon as the code tries to connect a service client the message similar to below is shown
There was no endpoint listening at http://servername/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond *10.1.2.252:8080*
It is interesting that 10.1.2.252:8080 should be mentioned as I can find no mention of that in either IE proxy settings or netsh so I have no idea where it is originating from.
I can bypass the problem by adding useDefaultWebProxy="false" to the bindings but as no other users get this I want to get to the bottom of this.
Does anyone have any suggestions on where the incorrect proxy address may be originating from - (it is not in any files in the solution as I have searched for it)?