Timeout Error for AWS SNSClient. Post request

Here is the code snippet:

//Publishing the topic snsClient.Publish(new PublishRequest { Subject = Constants.SNSTopicMessage, Message = snsMessageObj.ToString(), TopicArn = Settings.TopicArn }); 

I get the following error:

The connected connection was closed: the expected connection to be alive was closed by the server.

And here is a screenshot of the detailed error: enter image description here

But I can’t understand how to solve this. Any hints or links would be helpful.

+8
amazon-web-services amazon-sns
source share
3 answers

We had the same problem with us. We received this error about 40 times a day, which was less than 0.1% of the successful push notifications that we sent.

Our solution? Update AWSSDK NuGet from 1.5.30.1 to 2.3.52.0 (latest v2 to simplify the upgrade). As soon as we were updated, errors ceased to occur. I looked through a lot of release notes and did not find anything specific mentioning this issue. We do not know why the update worked, but it happened.

Hope this helps you and everyone else fix this problem.

+2
source share

This issue may occur when one or more of the following conditions is true:

β€’ A network failure will occur.

β€’ The proxy server blocks the HTTP request.

β€’ There is a problem with the domain name system (DNS).

β€’ There is a network authentication problem.

[https://nilangshah.wordpress.com/2007/03/01/the-underlying-connection-was-closed-unable-to-connect -to-the-remote-server /] 1

0
source share
  • make sure that the size of your payload should not exceed 256 kb
  • make sure you set the timeout property for PutObjectRequest

Take a look at the aws sns request code example (from https://stackoverflow.com/a/1271919/ ... )

 // Create topic string topicArn = client.CreateTopic(new CreateTopicRequest { Name = topicName }).CreateTopicResult.TopicArn; // Set display name to a friendly value client.SetTopicAttributes(new SetTopicAttributesRequest { TopicArn = topicArn, AttributeName = "DisplayName", AttributeValue = "StackOverflow Sample Notifications" }); // Subscribe an endpoint - in this case, an email address client.Subscribe(new SubscribeRequest { TopicArn = topicArn, Protocol = "email", Endpoint = "sample@example.com" }); // When using email, recipient must confirm subscription Console.WriteLine("Please check your email and press enter when you are subscribed..."); Console.ReadLine(); // Publish message client.Publish(new PublishRequest { Subject = "Test", Message = "Testing testing 1 2 3", TopicArn = topicArn }); // Verify email receieved Console.WriteLine("Please check your email and press enter when you receive the message..."); Console.ReadLine(); // Delete topic client.DeleteTopic(new DeleteTopicRequest { TopicArn = topicArn }); 
0
source share

All Articles