【问题标题】:DELETE Http Method takes forever and might timeout on WebApiDELETE Http 方法需要很长时间,并且可能在 WebApi 上超时
【发布时间】:2013-07-26 05:40:20
【问题描述】:

我真的找不到解释,我向这个 API 端点发送了一个 DELETE 请求,我的代码很简单:

    public HttpResponseMessage DeleteSize(int id) {

        Size size;

        try {

            size = db.Sizes.First(q => q.ID == id);
            size.Deleted = true;
            db.SaveChanges();
        } catch (Exception ex) {
            return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
        }

        return Request.CreateResponse(HttpStatusCode.OK, size);
    }

但是,在 Azure 登台服务器上,它需要永远响应,它在本地运行非常快,但不确定它在远程服务器上时发生了什么,这可能是什么原因?,所有其他调用 GET/POST/PULL及时响应。

【问题讨论】:

    标签: azure asp.net-web-api


    【解决方案1】:

    看起来问题是我在 Request.CreateResponse 中返回了 db 模型,可能与 dbContext 有关

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-17
      • 2010-11-28
      • 1970-01-01
      • 1970-01-01
      • 2018-07-04
      • 2013-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多