更新时间:2021-08-30 08:13:39
在ASP.NET Core 2.2中,我们发布了一个新的服务器,该服务器在Windows场景的IIS内运行.您遇到的问题看起来像: https://github.com/aspnet/AspNetCore/issues/4398 .
In ASP.NET Core 2.2, we released a new Server which runs inside IIS for Windows scenarios. The issue you are running into looks like: https://github.com/aspnet/AspNetCore/issues/4398.
发送XMLHttpRequest时,会有一个预检OPTIONS请求,该请求返回状态码204.IIS服务器不正确地处理了该请求,从而向客户端返回了无效的响应.
When sending the XMLHttpRequest, there is a preflight OPTIONS request which returns a status code of 204. This was incorrectly handled by the IIS server, returning an invalid response to the client.
在您的ASP.NET Core应用程序中,您可以暂时尝试解决方法吗:
In your ASP.NET Core application, can you please try the workaround for now:
app.Use(async (ctx, next) =>
{
await next();
if (ctx.Response.StatusCode == 204)
{
ctx.Response.ContentLength = 0;
}
});