Questions tagged [sendasync]

83 questions
2
votes
1 answer

Sending Messages One-Way Only Through a Asp.Net Core WebSocket

I am working on an C# Asp.NET Core app where clients will connect via a JavaScript WebSocket to the server and the server itself will be the only thing that can send messages to the connected clients. The clients will not be sending messages back to…
osswmi
  • 43
  • 6
2
votes
2 answers

SendAsync() returning 422 Unprocessable Entity

I wrote a function using GetAsync() which works fine, but now i'd like to expand on it using SendAsync() instead [for POSTing and sofourth]; however my SendAsync() version is not working as expected, it returns a 422 unprocessible entity. (no IDE…
kei
  • 159
  • 9
2
votes
1 answer

Httpclient.SendAsync loads StreamContent into memory before sending it to the server

I'm trying to perform a large video upload to a server, but no matter what I do, if I'm using Httpclient.SendAsync(HttpResponseMessage) to send the content I have assigned to the HttpResponseMessage among with all the headers and such, the whole…
Dezv
  • 156
  • 1
  • 8
2
votes
1 answer

SendAsync is blocking UI thread

Trying to convert part of my program into asynchronous http client call. Took out part of code (which is below) to test. Basically an async'ed button with non-blocking (should be to my knowledge) SendAsync(). It should not block UI thread, am I…
T-series
  • 25
  • 1
  • 5
2
votes
1 answer

Why does SendAsync not raise the Completed Event on my SocketAsyncEventArgs even though my Server-Socket has already received all bytes?

So I am having a very simple setup: A Server that waits for a Client to connect and a Client who connects to the Server and sends messages. The Server should afterwards send the same message back again. But when I try to send the message with…
Chris
  • 41
  • 3
2
votes
4 answers

Socket.SendAsync is not sending in-order on Mono/Linux

There is a a single-threaded server using .NET Socket with TCP protocol, and Socket.Pool(), Socket.Select(), Socket.Receive(). To send, I used: public void SendPacket(int clientid, byte[] packet) { clients[clientid].socket.Send(packet); } But…
exe
  • 31
  • 5
2
votes
1 answer

How do I dispose System.Net.Mail.MailMessage in VB when using SendAsync

I have not managed to find a conclusive answer for this on here or in MSDN. When using the following code, if I try to dispose the message after sending the asynch mail then I get a System.ObjectDisposedException: Cannot access a disposed object.…
coderX
  • 53
  • 6
2
votes
2 answers

base.SendAsync -How symmetrical execution was done?

In asp.net - using Message Handlers - I can customize the request/response by adding message handlers. So, a request comes in , going through multiple message handlers and then the response is back through the same handlers( in opposite…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
2
votes
2 answers
2
votes
1 answer

SendAsync runs but the data is not really sent

I have an application that communicate through sockets using the *Async methods (like SendAsync). I'm getting this strange behavior where SendAsync is executed but the data is not sent over the wire. I've enabled network tracing and got the…
Fernando
  • 4,029
  • 1
  • 26
  • 35
1
vote
3 answers

Is it wise to use SMTP.SendAsync in asp.net

I'm writing a code that sends 2 codes to 2 different emails (to check that owner of both emails are the same person). And I got the error: System.InvalidOperationException: An asynchronous call is already in progress. It must be completed or…
Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171
1
vote
3 answers

.NET SMTP SendAsync with AlternateViews throws disposed exception

I am trying to send E-mails asynchronously and it works fine as long as there isn't an AlternateView attached to the e-mail. When there is an alternate view, I get the following error: Cannot access a disposed object. Object name:…
hacker
  • 1,115
  • 1
  • 15
  • 28
1
vote
1 answer

How to send a post request in dotnet with a list of request headers

public static async Task Post(string endPoint, string data){ HttpContent c = new StringContent(data, Encoding.UTF8, "application/json"); using (var client = new HttpClient()) { …
Concellia
  • 15
  • 1
  • 4
1
vote
1 answer

HttpClient.SendAsync on Blazor WASM returns empty HttpResponseMessage although Fiddler shows that correct response was received

My Blazor page code: private async Task OnSendSMSClick() { var request = new HttpRequestMessage(HttpMethod.Post, baseAddress); request.SetBrowserRequestMode(BrowserRequestMode.NoCors); …
1
vote
0 answers

HttpClient.SendAsync in DotNetCore - Is a Deadlock Possible?

We get an occasional TaskCanceledException on a call that, according to our logs, completes well inside the timeout we configure for the request. The first log entry is from the server. This is the last thing the method logs out before returning a…
Stuart
  • 1,572
  • 4
  • 21
  • 39