【问题标题】:Returning Resized Image from WebImage in RouteHandler从 RouteHandler 中的 WebImage 返回调整大小的图像
【发布时间】:2015-01-09 09:34:14
【问题描述】:

我正在路由我的图像并通过 imageRouteHandler 调整它们的大小。 这是代码。

 public class ImageRouteHandler : IRouteHandler
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            var filePath="(from Request Context)"
            var image = new WebImage(filePath);
            image = image.Resize(width, height);
            image.Write();
            return null;
        }
    }

我收到了这个错误,

The route handler '...ImageRouteHandler' did not return an IHttpHandler from its GetHttpHandler() method.

WebImage.Write() 将写入我所知道的响应。这里还需要什么?

【问题讨论】:

    标签: c# image ihttphandler mvcroutehandler webimage


    【解决方案1】:

    添加

    requestContext.HttpContext.Response.End();
    

    return null; 成功之前。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-11
      • 1970-01-01
      • 2012-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-01
      相关资源
      最近更新 更多