我第一次运行我的应用程序时一切正常。我可以毫无问题地注册项目。
但是关闭应用程序并再次运行后,会出现以下错误:
完整图片在:http: //i.stack.imgur.com/33Whm.png
配置
忍者
public class RavenDBNinjectModule : NinjectModule
{
public override void Load()
{
Bind<IDocumentStore>().ToMethod(context =>
{
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
var documentStore = new EmbeddableDocumentStore { ConnectionStringName="RavenDB", UseEmbeddedHttpServer = true };
return documentStore.Initialize();
}).InSingletonScope();
Bind<IDocumentSession>().ToMethod(context => context.Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
}
}
连接字符串
<connectionStrings>
<add name="RavenDB" connectionString="DataDir = ~\App_Data" />
</connectionStrings>
控制器
private readonly IDocumentSession _documentSession;
public PluginsController (IDocumentSession documentSession)
{
_documentSession = documentSession;
}