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