This error occurs only in our production enviromnent, not locally or on the test server. I´ve narrowed it down to the preset-node in the configuration. The exception is thrown when I have presets defined and start the web site. If I comment the preset-element the site starts and images can be scaled manually through the query params.
The call stack:
Exception Details: System.Web.HttpException: Response is not available in this context.
[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
It made HttpUtility.UrlEncode dependent upon having a valid HttpContext.
More details about the bug can be found here.