.Net Core 2.1.6 Api在返回状态码205时挂起

问题描述 投票:1回答:0

我有一个Api,我们需要从中返回状态代码205。 无论何时击中此代码,Api都将挂起,PostMan或任何测试都不会返回任何响应。 即使在禁用所有中间件和自定义库之后,它的行为仍然相同。

   [Route("")]   
   public class PingController : Controller
   {
      // GET
      [HttpGet("ping")]
      public IActionResult Index()
      {
         return StatusCode(205);
      }
  }

下面的作品。 204、200、201等所有工作。 205使它挂起。

  [Route("")]   
   public class PingController : Controller
   {
      // GET
      [HttpGet("ping")]
      public IActionResult Index()
      {
         return StatusCode(204);
      }
  }

我不知道是什么原因造成的,并且我开始怀疑这是否是.Net Core中的错误? 尽管...必须说,使用2.1的新解决方案效果很好。 我试图将2.1.6降级到2.1.1,但也无济于事。

只想知道是否有人遇到过相同的问题? 几乎感觉像是一件穿线的东西...

编辑1.有趣的是,当在launchSettings.json中将“ commandName”:“ Project”更改为“ commandName”:“ IISExpress”时,此方法有效

编辑2。如果返回return StatusCode(205,null); 然后就可以了 感觉像个虫子吗?

api asp.net-core .net-core asp.net-apicontroller
© www.soinside.com 2019 - 2024. All rights reserved.