I have a web app that is using NH search. The indexes are stored off
the root of the virtual directory
~/Index/[folder per entity]
Sometimes our end users are prompted for their user name and password.
they hit cancel, close the browser, return to the page and it appears
all the data was saved correctly. the problem appears to be
intermittent and this wasn't a problem during local development or the
testing server.
here is how session/search is resolved for the web application.
Kernel
.Register(
Component
.For<ISessionFactory>()
.LifeStyle.Singleton
.UsingFactoryMethod(k => k
.Resolve<Configuration>()
.BuildSessionFactory()),
Component
.For<ISession>()
.Forward<IFullTextSession>()
.LifeStyle.Transient
.UsingFactoryMethod(k => k
.Resolve<ISessionFactory>()
.GetCurrentSession()));
the session is scoped per request
public class Global : HttpApplication, IContainerAccessor
{
private static IWindsorContainer container;
protected void Application_Start(object sender, EventArgs e)
{
container = new WindsorContainer(new XmlInterpreter())
.AddFacility<LoggingFacility>("logging")
.AddFacility<FactorySupportFacility>()
.AddFacility<MonoRailFacility>()
.AddFacility<MyFacility>();
}
protected void Application_End(object sender, EventArgs e)
{
container.Dispose();
}
protected void Application_Error(object sender, EventArgs e)
{
var exception = Server.GetLastError();
if(exception == null) return;
Container
.Resolve<ILoggerFactory>()
.Create(typeof (Global))
.Error(exception.Message, exception);
}
public Global()
{
BeginRequest += OpenSession;
EndRequest += DisposeOfSession;
}
public IWindsorContainer Container
{
get { return container; }
}
private void OpenSession(object sender, EventArgs e)
{
var session = Container.Resolve<ISessionFactory>().OpenSession();
var fullTextSession = Search.CreateFullTextSession(session);
CurrentSessionContext.Bind(fullTextSession);
}
private void DisposeOfSession(object sender, EventArgs e)
{
var factory = Container.Resolve<ISessionFactory>();
CurrentSessionContext.Unbind(factory).Dispose();
}
}
I have looked at permissions. the user has read/write access to the
Index from IIS. the logging directory has read/write access as well
and the logs are empty, so either the error is not logged, or the
there isn't an error that
asp.net is picking up.
the event logs show the error
Unable to find assembly 'Lucene.Net, Version=2.3.2.1, Culture=neutral,
PublicKeyToken=null'.
this is logged by the .Net or IIS framework, not my application. The
file is in the bin folder though. framework versions
Nh 2.1.2.4
lucene 2.3.2.1
NH Search 2.0.0.1001
any pointers on where to go from here? Could it be a IIS application
pool reset issue; altering the index changed too many files and IIS
resets the pool? if so, would moving the index to the App_Data
directory prevent this?
Other than that I'm at a loss at this point.