Response is not available in this context

715 views
Skip to first unread message

Daniel Steigerwald

unread,
Jul 29, 2010, 8:38:10 PM7/29/10
to ravendb
What's wrong now? :(
Why IndexCreation.CreateIndexes works only in BeginRequest?

protected void Application_Start()
{
_documentStore = new DocumentStore();
if (AppDeployed) _documentStore.DataDirectory = "App_Data";
else _documentStore.Url =
ConfigurationManager.AppSettings["RavenDbUrl"];
_documentStore.Initialize();
// this throws the exception
IndexCreation.CreateIndexes(typeof(Matters_Stream).Assembly,
_documentStore);

AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
// for JSON rest
ValueProviderFactories.Factories.Add(new JsonValueProviderFactory());
}

Server Error in '/' Application.

Response 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: Response is not available
in this context.

Source Error:


Line 116: UserService.Create("dan...@steigerwald.cz",
"************");
Line 117: var store = _documentStore;
Line 118:
IndexCreation.CreateIndexes(typeof(Matters_Stream).Assembly,
_documentStore);
Line 119: }
Line 120:

Source File: c:\Dev\Matters\Matters\Global.asax.cs Line: 118

Stack Trace:


[HttpException (0x80004005): Response is not available in this
context.]
System.Web.HttpContext.get_Response() +8753496
System.Web.Util.HttpEncoder.get_Current() +39
System.Web.HttpUtility.UrlEncodeToBytes(String str, Encoding e) +31
System.Web.HttpUtility.UrlEncode(String str) +41
Raven.Database.Linq.DynamicViewCompiler..ctor(String name,
IndexDefinition indexDefinition, AbstractDynamicCompilationExtension[]
extensions) +77

Raven.Database.Storage.IndexDefinitionStorage.AddAndCompileIndex(String
name, IndexDefinition indexDefinition) +143
Raven.Database.Storage.IndexDefinitionStorage.AddIndex(String name,
IndexDefinition indexDefinition) +56
Raven.Database.DocumentDatabase.PutIndex(String name,
IndexDefinition definition) +299
Raven.Client.Client.EmbededDatabaseCommands.PutIndex(String name,
IndexDefinition definition, Boolean overwrite) +270

Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDocumentStore
documentStore) +107

Raven.Client.Indexes.IndexCreation.CreateIndexes(CompositionContainer
catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) +151
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly
assemblyToScanForIndexingTasks, IDocumentStore documentStore) +115
Matters.MvcApplication.LoadFixtures() in c:\Dev\Matters\Matters
\Global.asax.cs:118
Matters.MvcApplication.Application_Start() in c:\Dev\Matters\Matters
\Global.asax.cs:78

[HttpException (0x80004005): Response is not available in this
context.]

System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +9024793
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +131
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194

System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +253

[HttpException (0x80004005): Response is not available in this
context.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+8946484
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+97

System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.1

Daniel Steigerwald

unread,
Jul 29, 2010, 8:43:09 PM7/29/10
to ravendb
And now, something ...

Server Error in '/' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:


Line 81: else _documentStore.Url =
ConfigurationManager.AppSettings["RavenDbUrl"];
Line 82:
Line 83: _documentStore.Initialize();
Line 84:
Line 85: LoadFixtures();

Source File: c:\Dev\Matters\Matters\Global.asax.cs Line: 83

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]
Raven.Client.Document.DocumentStore.get_DatabaseCommands() +35
Raven.Client.Document.DocumentStore.Dispose() +47
Raven.Client.Document.DocumentStore.Initialize() +670
Matters.MvcApplication.Application_Start() in c:\Dev\Matters\Matters
\Global.asax.cs:83

[HttpException (0x80004005): Object reference not set to an instance
of an object.]

System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +9024793
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +131
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194

System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +253

[HttpException (0x80004005): Object reference not set to an instance
of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+8946484
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+97

System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.1

Daniel Steigerwald

unread,
Jul 29, 2010, 8:45:13 PM7/29/10
to ravendb
Neverending story...

Server Error in '/' Application.

The process cannot access the file 'C:\dev\Matters\Matters\App_Data
\Indexes\Matters%2fStream\write.lock' because it is being used by
another process.

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.IO.IOException: The process cannot access
the file 'C:\dev\Matters\Matters\App_Data\Indexes\Matters%2fStream
\write.lock' because it is being used by another process.

Source Error:


Line 51: {
Line 52: fuckOffAllWorld = true;
Line 53:
IndexCreation.CreateIndexes(typeof(Matters_Stream).Assembly,
_documentStore);
Line 54: }
Line 55: HttpContext.Current.Items[RavenSessionKey] =
_documentStore.OpenSession();

Source File: c:\Dev\Matters\Matters\Global.asax.cs Line: 53

Stack Trace:


[IOException: The process cannot access the file 'C:\dev\Matters
\Matters\App_Data\Indexes\Matters%2fStream\write.lock' because it is
being used by another process.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
+9726486
System.IO.File.Delete(String path) +9563972
Lucene.Net.Store.NativeFSLockFactory.ClearLock(String lockName)
+213
Lucene.Net.Store.Directory.ClearLock(String name) +21
Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean
create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean
autoCommit, Int32 maxFieldLength, IndexingChain indexingChain,
IndexCommit commit) +138
Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a,
MaxFieldLength mfl) +469

Raven.Database.Indexing.IndexStorage.OpenOrCreateLuceneDirectory(String
indexDirectory) +298

Raven.Database.Indexing.<>c__DisplayClass3.<CreateIndexImplementation>b__0(String
n) +54

System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey
key, Func`2 addValueFactory, Func`3 updateValueFactory) +125

Raven.Database.Indexing.IndexStorage.CreateIndexImplementation(String
name, IndexDefinition indexDefinition) +297
Raven.Database.DocumentDatabase.PutIndex(String name,
IndexDefinition definition) +337
Raven.Client.Client.EmbededDatabaseCommands.PutIndex(String name,
IndexDefinition definition, Boolean overwrite) +270

Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDocumentStore
documentStore) +107

Raven.Client.Indexes.IndexCreation.CreateIndexes(CompositionContainer
catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) +151
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly
assemblyToScanForIndexingTasks, IDocumentStore documentStore) +115
Matters.MvcApplication.MvcApplication_BeginRequest(Object sender,
EventArgs e) in c:\Dev\Matters\Matters\Global.asax.cs:53

System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.1


Daniel Steigerwald

unread,
Jul 29, 2010, 9:01:07 PM7/29/10
to ravendb
It's curse or what?

Server Error in '/' Application.

Error KeyDuplicate (JET_errKeyDuplicate, Illegal duplicate key)

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: Microsoft.Isam.Esent.Interop.EsentErrorException:
Error KeyDuplicate (JET_errKeyDuplicate, Illegal duplicate key)

Source Error:

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.

Stack Trace:


[EsentErrorException: Error KeyDuplicate (JET_errKeyDuplicate, Illegal
duplicate key)]
Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32
bookmarkSize, Int32& actualBookmarkSize) +305
Microsoft.Isam.Esent.Interop.Update.Save() +27

Raven.Storage.Esent.StorageActions.DocumentStorageActions.AddIndex(String
name) +368

Raven.Database.DocumentDatabase.AddIndexAndEnqueueIndexingTasks(IStorageActionsAccessor
actions, String indexName) +159

Raven.Database.<>c__DisplayClass3f.<PutIndex>b__3e(IStorageActionsAccessor
actions) +63
Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1
action) +409
Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action)
+298
Raven.Database.DocumentDatabase.PutIndex(String name,
IndexDefinition definition) +716
Raven.Client.Client.EmbededDatabaseCommands.PutIndex(String name,
IndexDefinition definition, Boolean overwrite) +437

Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDocumentStore
documentStore) +213

Raven.Client.Indexes.IndexCreation.CreateIndexes(CompositionContainer
catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) +225
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly
assemblyToScanForIndexingTasks, IDocumentStore documentStore) +175
Matters.MvcApplication.MvcApplication_BeginRequest(Object sender,
EventArgs e) in c:\Dev\Matters\Matters\Global.asax.cs:53

System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +266
> ...
>
> číst dál »

Ayende Rahien

unread,
Jul 29, 2010, 9:21:09 PM7/29/10
to rav...@googlegroups.com
Um, given the flood of errors, I am not sure.
What happen if you delete the database and try from scratch?

Daniel Steigerwald

unread,
Jul 29, 2010, 9:27:52 PM7/29/10
to ravendb
I just switched AppDeployed to true. It should create db, indexes,
load some fixtures...

protected void Application_Start()
{
_documentStore = new DocumentStore();
if (AppDeployed) _documentStore.DataDirectory = "App_Data";
else _documentStore.Url =
ConfigurationManager.AppSettings["RavenDbUrl"];
_documentStore.Initialize();


> ...
>
> číst dál >>

Daniel Steigerwald

unread,
Jul 29, 2010, 9:31:59 PM7/29/10
to ravendb
I can't make failing test now. But it should be easy to repeat what I
did.
1) create mvc app
2) install raven server
3) add common stuff (begin/end request)
4) in app start, add some indexes
5) enjoy working raven
6) switch raven from Url to DataDirectory
7) In my case -> exceptions Armageddon
> ...
>
> číst dál >>

Daniel Steigerwald

unread,
Jul 29, 2010, 9:34:56 PM7/29/10
to ravendb
In the other words. It was from scratch.
> ...
>
> číst dál >>

Daniel Steigerwald

unread,
Jul 30, 2010, 5:37:42 AM7/30/10
to ravendb
Ayende. These errors has to be will be fixed. Embedded raven is
unusable.

On 30 čnc, 03:34, Daniel Steigerwald <dan...@steigerwald.cz> wrote:
> In the other words. It was from scratch.
>
> On 30 ènc, 03:31, Daniel Steigerwald <dan...@steigerwald.cz> wrote:
>
>
>
> > I can't make failing test now. But it should be easy to repeat what I
> > did.
> > 1) create mvc app
> > 2) install raven server
> > 3) add common stuff (begin/end request)
> > 4) in app start, add some indexes
> > 5) enjoy working raven
> > 6) switch raven from Url to DataDirectory
> > 7) In my case -> exceptionsArmageddon
>
> > Armageddon
>
> > On 30 ènc, 03:27, Daniel Steigerwald <dan...@steigerwald.cz> wrote:
>
> > > I just switched AppDeployed to true. It should create db, indexes,
> > > load some fixtures...
>
> > > protected void Application_Start()
> > > {
> > >         _documentStore = new DocumentStore();
> > >         if (AppDeployed) _documentStore.DataDirectory = "App_Data";
> > >                 else _documentStore.Url =
> > > ConfigurationManager.AppSettings["RavenDbUrl"];
> > >                 _documentStore.Initialize();
>
> ...
>
> číst dál »

Ayende Rahien

unread,
Jul 30, 2010, 5:40:48 AM7/30/10
to rav...@googlegroups.com
I assure you that they'll be.

Daniel Steigerwald

unread,
Jul 30, 2010, 6:09:59 AM7/30/10
to ravendb
New day. New bug. Same configuration.

There is no index named: Matters/Stream

ERRORSHELPABOUT
Raven.Database.Exceptions.IndexDoesNotExistsException
There is no index named: Matters/Stream

Raven.Database.Exceptions.IndexDoesNotExistsException: There is no
index named: Matters/Stream
at
Raven.Storage.Esent.StorageActions.DocumentStorageActions.SetCurrentIndexStatsTo(String
index)
at
Raven.Storage.Esent.StorageActions.DocumentStorageActions.GetFailureRate(String
index)
at
Raven.Database.DocumentDatabase.<>c__DisplayClass49.<Query>b__44(IStorageActionsAccessor
actions)
at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1
action)
at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action)
at Raven.Database.DocumentDatabase.Query(String index, IndexQuery
query)
at Raven.Client.Client.EmbededDatabaseCommands.Query(String index,
IndexQuery query)
at Raven.Client.Document.DocumentQuery`1.GetQueryResult()
at Raven.Client.Document.AbstractDocumentQuery`1.get_QueryResult()
at Raven.Client.Document.AbstractDocumentQuery`1.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Matters.QueryObjects.MattersStreamQuery.Execute() in c:\Dev
\Matters\Matters\QueryObjects\MattersStream.cs:line 34
at Matters.Controllers.RootController.Data() in c:\Dev\Matters
\Matters\Controllers\RootController.cs:line 30
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters)
at
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2
parameters)
at
System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a()
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c()
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionDescriptor actionDescriptor,
IDictionary`2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext
requestContext)
at
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext)
at
System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__4()
at
System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at
System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult
_)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
asyncResult)
at
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result)
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
> ...
>
> číst dál »

Daniel Cazzulino

unread,
Jul 30, 2010, 7:53:04 AM7/30/10
to rav...@googlegroups.com

I think a less monolithic raven web would be great, so that you can integrate more easily on an existing website, and be able to access the document store both in-proc server side (I.e. from mvc controllers) as well as from the client (javascript or win client)

from android nexus1

Ayende Rahien

unread,
Jul 30, 2010, 8:47:32 AM7/30/10
to rav...@googlegroups.com

Ayende Rahien

unread,
Jul 30, 2010, 8:48:09 AM7/30/10
to rav...@googlegroups.com
Sorry about that, again.
The actual problem(s) relates to errors in error handling in embedded mode.
I just pushed a new build, and it should fix this issues.

Daniel Cazzulino

unread,
Jul 30, 2010, 12:58:14 PM7/30/10
to rav...@googlegroups.com
not really. 

you don't want to start an HTTP server if you're already running in a web app in IIS, do you? The listening port will already be taken by IIS, etc.

it's mostly about more granular configuration of the responders, etc.

/kzu

--
Daniel Cazzulino | Developer Lead | XML MVP | Clarius Consulting | +1 425.329.3471
Reply all
Reply to author
Forward
0 new messages