title: Response is not available in this context
body: <p>I have problem. Locally everything works fine but in the production server it always throws exception 'Response is not available in this context'. What can be the problem? I've noticed that a lot of people experience this problem due to some changes of global.asax. Here is the code of global.asax, the part related to application start. </p>
  
  <pre><code>    protected void Application_Start() {
          AreaRegistration.RegisterAllAreas();
          RegisterRoutes(RouteTable.Routes);
          Application["SystemUser"] = TUser.GetUserByIdentifier("system").UID;
          InitializeSolrInstances();
          SearchIndexer.DoIndex();
          StartRatingTimer();
          SolrManager.RecalculateMostRequested();
      }
  
      private static void InitializeSolrInstances() {
          SolrConfigurationManager.InitSolrConnection&lt;OfferItemPresenter&gt;(Resources.ApplicationResources.SolrServiceURL + "/offer");
          SolrConfigurationManager.InitSolrConnection&lt;SavedQueryItemPresenter&gt;(Resources.ApplicationResources.SolrServiceURL + "/savedquery");
          SolrConfigurationManager.InitSolrConnection&lt;TopProductsPresenter&gt;(Resources.ApplicationResources.SolrServiceURL + "/topproducts");
          SolrConfigurationManager.InitSolrConnection&lt;TopSellersPresenter&gt;(Resources.ApplicationResources.SolrServiceURL + "/topsellers");
          SolrConfigurationManager.InitSolrConnection&lt;MostRequestedItemPresenter&gt;(Resources.ApplicationResources.SolrServiceURL + "/mostrequested");
          SolrConfigurationManager.InitSolrConnection&lt;MostRequestedQuery&gt;(Resources.ApplicationResources.SolrServiceURL + "/requestedquery");
      }
  
      private void StartRatingTimer() {
          _LastRatingRenewedTime = DateTime.Now;
          DateTime CurrentTime = DateTime.Now;
          DateTime StartTime = new DateTime(2011, 1, 1);
          GlobalSettings.ReIndexMainSolrCores(StartTime, CurrentTime);
          Timer OfferAndUserRatingRenewerTimer = new Timer() {
              /*Timer interval for 24 hours*/
              Interval = 24 * 60 * 60 * 1000, Enabled = true };
          OfferAndUserRatingRenewerTimer.Elapsed += new ElapsedEventHandler(OfferAndUserRatingRenewerTimer_Elapsed);
      }
      public void OfferAndUserRatingRenewerTimer_Elapsed(Object Sender, ElapsedEventArgs e) {
          GlobalSettings.ReIndexMainSolrCores(_LastRatingRenewedTime, e.SignalTime);
          _LastRatingRenewedTime = e.SignalTime;
      }
  </code></pre>
  
  <p>I do not use Response or Request properties of HttpContext at all. Neither in global asax itself, nor within the methods to be called. Help me.</p>
  
  <p>That what it shows.
  `
    Server Error in '/' Application.</p>
  
  <p>Response is not available in this context.</p>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.Web.HttpException: Response is not available in this context.</p>
  
  <p>Source Error: </p>
  
  <p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</p>
  
  <p>Stack Trace: </p>
  
  <pre><code>[HttpException (0x80004005): Response is not available in this context.]
     System.Web.Util.HttpEncoder.get_Current() +11406684
     System.Web.HttpUtility.UrlEncode(String str, Encoding e) +137
     SolrNet.Impl.SolrConnection.&lt;Get&gt;b__0(KeyValuePair`2 input) +89
     SolrNet.Utils.&lt;Select&gt;d__1a`2.MoveNext() +612
     SolrNet.Utils.Func.Reduce(IEnumerable`1 source, TResult startValue, Accumulator`2 accumulator) +393
     SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters) +908
     SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options) +195
     SolrNet.Impl.SolrBasicServer`1.Query(ISolrQuery query, QueryOptions options) +176
     SolrNet.Impl.SolrServer`1.Query(ISolrQuery query, QueryOptions options) +176
     TebeComSearchEngine.SolrManager.RecalculateMostRequested() in SolrManager.cs:77
     TebeCom.MvcApplication.Application_Start() in Global.asax.cs:101
  
  [HttpException (0x80004005): Response is not available in this context.]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4043621
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
     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) +11612256
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4842149`
  </code></pre>