vendredi 2 janvier 2015

Unable to post data into SQS from ASP.Net WebAPI 2

I am trying to post some data to an AWS SQS queue from an ASP.Net webapi application. I am using AmazonSQSClient SendMessage() to do this.


It is working fine in console applications and windows services. However, when I try the same thing from a webapi application, the SendMessage() method thorows the following exception:


[Amazon.Runtime.AmazonServiceException] {"Encountered a WebException (ConnectFailure), the request cannot be retried. Either the maximum number of retries has been exceeded (4/4) or the request is using a non-seekable stream."}


Inner exception: {"An error occurred while sending the request."}, {"Unable to connect to the remote server"}


Stack trace: at Amazon.Runtime.AmazonWebServiceClient.RetryOrThrow(WebRequestState state, Exception exception) at Amazon.Runtime.AmazonWebServiceClient.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Amazon.Runtime.AmazonWebServiceClient.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Amazon.Runtime.AmazonWebServiceClient.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Amazon.Runtime.AmazonWebServiceClient.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Amazon.Runtime.AmazonWebServiceClient.d__3`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Amazon.SQS.AmazonSQSClient.SendMessage(SendMessageRequest request) at WebAPI.Alerts.Controllers.AlertsController.SendMessage(Queue queue, QueueRequest request) in c:....\Controllers\AlertsController.cs:line 418


Can anyone please help me in this?





Aucun commentaire:

Enregistrer un commentaire