【问题标题】:ImageResizer - ParseQueryOnly - Response is not available in this context, when initialized on production serverImageResizer - ParseQueryOnly - 在生产服务器上初始化时,响应在此上下文中不可用
【发布时间】:2013-05-30 09:28:20
【问题描述】:

此错误仅发生在我们的生产环境中,而不是本地或测试服务器上。我已将其范围缩小到配置中的预设节点。当我定义了预设并启动网站时会引发异常。如果我评论预设元素,则站点启动,并且可以通过查询参数手动缩放图像。

调用栈:

异常详细信息:System.Web.HttpException:响应在此上下文中不可用。

[HttpException (0x80004005): Response is not available in this context.]
   System.Web.HttpUtility.UrlDecode(String str, Encoding e) +4841588
   ImageResizer.Util.PathUtils.ParseQueryOnly(String query, Boolean allowSemicolons, Boolean urlDecode) +307
   ImageResizer.ResizeSettings..ctor(String queryString) +224
   ImageResizer.Plugins.Basic.Presets.ParseXml(Node n, Config conf) +870
   ImageResizer.Plugins.Basic.Presets.Install(Config c) +98
   ImageResizer.Configuration.PluginConfig.loadPluginsInternal() +303
   ImageResizer.Configuration.PluginConfig.LoadPlugins() +61
   ImageResizer.Configuration.Config.get_Current() +109



[HttpException (0x80004005): Response is not available in this context.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3985477
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Response is not available in this context.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309

【问题讨论】:

    标签: imageresizer


    【解决方案1】:

    ASP.NET 框架中的这种回归was introduced in .NET 4.0 RTM, and has been patched in a later updates to the framework

    它使 HttpUtility.UrlEncode 依赖于有效的 HttpContext。

    更多关于the bug can be found here的细节。

    【讨论】:

      猜你喜欢
      • 2023-04-10
      • 2014-09-13
      • 2015-04-27
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      • 2013-12-29
      • 2010-09-23
      • 1970-01-01
      相关资源
      最近更新 更多