【问题标题】:HttpTaskAsyncHandler does not write response on remote serverHttpTaskAsyncHandler 不在远程服务器上写入响应
【发布时间】:2018-09-18 08:31:48
【问题描述】:

我正在向 .ashx 处理程序发出异步请求,这在本地没有问题,但是当我将内容发布到服务器时,它不会向我的客户端网站写入响应(其他同步请求也没有问题)。我尝试了很多东西,但无济于事。这是我的处理程序代码:

public override async Task ProcessRequestAsync(HttpContext context)
{
    var result = await SomeService.DoSomethingAsync(context.Request["id"]);

    context.Response.ContentType = "application/json";

    ApplicationLogging.Log(LogType.Info, 
      $"the result has keys:  {string.Join(", ",result.Keys)}");

    context.Response.Write(result);
    context.Response.End();
}

当我检查日志时,结果正是我所期望的,但响应没有返回给我的客户。

【问题讨论】:

    标签: c# .net asynchronous request ashx


    【解决方案1】:

    我不知道为什么但删除

        context.Response.End();
    

    修正了我的回复

    【讨论】:

      猜你喜欢
      • 2014-11-29
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      • 2013-05-11
      • 2015-12-05
      • 1970-01-01
      • 2016-11-29
      相关资源
      最近更新 更多