ImageResizer - ParseQueryOnly - 在生产服务器上初始化时,响应在此上下文中不可用

时间:2013-05-30 09:28:20

标签: imageresizer

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

调用堆栈:

异常详细信息: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

1 个答案:

答案 0 :(得分:0)

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的更多详情。