0

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

调用堆栈:

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

1 回答 1

0

ASP.NET 框架中的这种回归是在 .NET 4.0 RTM 中引入的,并已在框架的后续更新中进行了修补

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

可以在此处找到有关该错误的更多详细信息。

于 2013-05-30T14:24:37.460 回答