Skip to content

Postman POST request never hits controller endpoint! #62264

@khteh

Description

@khteh

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I run a debug session of the application and send a POST request from Postman. The POST request from Postman seems like taking forever and never hit the controller endpoint breakpoint. Irconically, once I cancel the request on the Postman side, it hits the contoller POST method/endpoint and the request completes successfully without seeing anything unusual at the Debug Console. Of course, the Postman won't show any response since the request was already cancelled.

Program.cs:

builder.Services.AddControllersWithViews();
app.MapControllers();

Controller:

[Route("api/[controller]")]
[ApiController]
public class AccountsController : ControllerBase 
{ 
    // POST api/auth/login
    [HttpPost("login")]
    [AllowAnonymous]
    //[ValidateAntiForgeryToken]
    public async Task<ActionResult> Login([FromBody] Models.Request.LogInRequest request)
    {
        if (!ModelState.IsValid) { return BadRequest(ModelState); }
        LogInResponse response = await _mediator.Send(new LogInCommand(request.UserName, request.Password, Request.HttpContext.Connection.RemoteIpAddress?.ToString()));
        return _mapper.Map<JsonContentResult>(response);
    }
}

Expected Behavior

Postman POST request hits controller endpoint.

Steps To Reproduce

No response

Exceptions (if any)

[06/06/2025 10:57:19 +08:00] Debug { Id: 1, Name: "AuthenticationFailed" } IP: CorrelationId: Agent: ContentType: ContentLength: RequestBody: RequestQuery: MemoryUsage:/398065664 Failed to authenticate HTTPS connection. {SourceContext="Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware", ConnectionId="0HND4KKA9F3V6", ThreadId=18, ExceptionDetail={["Type"]="System.IO.IOException", ["HResult"]=-2146232800, ["Message"]="Received an unexpected EOF or 0 bytes from the transport stream.", ["Source"]="System.Net.Security", ["TargetSite"]="Void MoveNext()"}} 
System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
   at System.Net.Security.SslStream.ReceiveHandshakeFrameAsync[TIOAdapter](CancellationToken cancellationToken)
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.OnConnectionAsync(ConnectionContext context)

[06/06/2025 10:57:19 +08:00] Debug { Id: 2, Name: "ConnectionStop" } IP: CorrelationId: Agent: ContentType: ContentLength: RequestBody: RequestQuery: MemoryUsage:/398065664 Connection id ""0HND4KKA9F3V6"" stopped. {SourceContext="Microsoft.AspNetCore.Server.Kestrel.Connections", ThreadId=18} 

[06/06/2025 10:57:19 +08:00] Debug { Id: 7, Name: "ConnectionWriteFin" } IP: CorrelationId: Agent: ContentType: ContentLength: RequestBody: RequestQuery: MemoryUsage:/398065664 Connection id ""0HND4KKA9F3V6"" sending FIN because: ""The Socket transport's send loop completed gracefully."" {SourceContext="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets", ThreadId=18} 

[06/06/2025 10:57:19 +08:00] Debug { Id: 3, Name: "HttpsConnectionEstablished" } IP: CorrelationId: Agent: ContentType: ContentLength: RequestBody: RequestQuery: MemoryUsage:/398065664 Connection "0HND4KKA9F3V7" established using the following protocol: "Tls13" {SourceContext="Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware", ThreadId=8} 

Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Server.Kestrel.Core.dll
4
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll

.NET Version

9.0.106

Anything else?

#61844

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issuearea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions