Request is not available in this context

417 views
Skip to first unread message

Chad Thiele

unread,
Sep 29, 2012, 9:45:16 PM9/29/12
to rav...@googlegroups.com
updated to 1.2.101 for the spatial indexing changes. Now, I'm getting the following error:

Request is not available in this context

Store = new EmbeddableDocumentStore { DataDirectory = "Data" };
[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpContext.get_Request() +9703152
   Raven.Database.Config.InMemoryRavenConfiguration.get_ServerUrl() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:337
   Raven.Database.Config.InMemoryRavenConfiguration.SetupOAuth() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:278
   Raven.Database.Config.InMemoryRavenConfiguration.Initialize() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:212
   Raven.Database.Config.RavenConfiguration.LoadConfigurationAndInitialize(IEnumerable`1 values) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:28
   Raven.Database.Config.RavenConfiguration..ctor() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:17
   Raven.Client.Embedded.EmbeddableDocumentStore.get_Configuration() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:63
   Raven.Client.Embedded.EmbeddableDocumentStore.set_DataDirectory(String value) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:90
   AtMyBase.Web.WebApiApplication.Application_Start() in Global.asax.cs:21

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9841101
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Chad Thiele

unread,
Sep 30, 2012, 2:07:39 AM9/30/12
to rav...@googlegroups.com
I created a new empty MVC 4 project and this error occurs immediately after "installing" raven and setting up global.asax.

I know these are unstable releases, but I can't get RavenDB build 960 to install/run under a new ASP.NET MVC 4 project. The NLog version causes the Nuget install to roll back. Is there a way to get build 960 setup on a fresh ASP.NET MVC 4 project?

Oren Eini (Ayende Rahien)

unread,
Sep 30, 2012, 2:29:03 AM9/30/12
to rav...@googlegroups.com
You need to start the EmbeddableDocumentStore outside of Application_Start

Chad Thiele

unread,
Sep 30, 2012, 9:18:48 AM9/30/12
to rav...@googlegroups.com
Ah ok... so in a BaseController, in OnActionExecuting?

Chad Thiele

unread,
Sep 30, 2012, 9:50:34 AM9/30/12
to rav...@googlegroups.com
Also, this is a change from build 960? Previously we were initializing the store in app_start, like so:

public class MvcApplication : System.Web.HttpApplication {

public static DocumentStore Store;

protected void Application_Start() {
AreaRegistration.RegisterAllAreas();

FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);

Store = new EmbeddableDocumentStore { DataDirectory = "Data" };
Store.Initialize();

Oren Eini (Ayende Rahien)

unread,
Oct 1, 2012, 7:38:10 AM10/1/12
to rav...@googlegroups.com
will be fixed in the next build.

Chad Thiele

unread,
Oct 3, 2012, 7:00:03 PM10/3/12
to rav...@googlegroups.com
Thanks Oren, awaiting the next build anxiously (to get back on track with a new project). 

Chad Thiele

unread,
Oct 6, 2012, 5:57:54 AM10/6/12
to rav...@googlegroups.com
Just tried the new build (5 Oct), still get "Request is not available in this context". Until it gets "fixed", where should I be initializing the EmbeddableDocumentStore? My development has halted without connectivity to ravendb.

Thanks.

Oren Eini (Ayende Rahien)

unread,
Oct 6, 2012, 12:37:27 PM10/6/12
to rav...@googlegroups.com
On the first request, rather than App_Start.

Can you share the full stack trace of the error you get?
Message has been deleted

Chad Thiele

unread,
Oct 7, 2012, 9:46:32 AM10/7/12
to rav...@googlegroups.com
Sure... here's the full stack trace

Request is not available in this context

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.

Exception Details: System.Web.HttpException: Request is not available in this context

Source Error:

Line 23: 
Line 24: 			// RavenDB
Line 25: 			Store = new EmbeddableDocumentStore { DataDirectory = "Data" };

Source File: c:\Users\*****\Documents\*****\*****\Global.asax.cs    Line: 25

Stack Trace:

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpContext.get_Request() +9703152
   Raven.Database.Config.InMemoryRavenConfiguration.get_ServerUrl() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:348
   Raven.Database.Config.InMemoryRavenConfiguration.SetupOAuth() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:278
   Raven.Database.Config.InMemoryRavenConfiguration.Initialize() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:212
   Raven.Database.Config.RavenConfiguration.LoadConfigurationAndInitialize(IEnumerable`1 values) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:28
   Raven.Database.Config.RavenConfiguration..ctor() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:17
   Raven.Client.Embedded.EmbeddableDocumentStore.get_Configuration() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:63
   Raven.Client.Embedded.EmbeddableDocumentStore.set_DataDirectory(String value) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:90
   AtMyBase.MvcApplication.Application_Start() in c:\Users\*****\Documents\*****\*****\Global.asax.cs:25

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9841101
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Request is not available in this context]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Oren Eini (Ayende Rahien)

unread,
Oct 7, 2012, 9:49:37 AM10/7/12
to rav...@googlegroups.com
Thanks, will really be fixed on the next build

Chad Thiele

unread,
Oct 10, 2012, 7:05:26 AM10/10/12
to rav...@googlegroups.com
Request issue has been resolved, thank you!
Reply all
Reply to author
Forward
0 new messages