1
我通过罗伯顿的优秀博客文章阅读RavenDB: http://codeofrob.com/archive/2010/05/09/ravendb-an-introduction.aspx我需要授予什么权限才能在服务器模式下运行RavenDB?
,我通过代码的工作,因为我读。但是,当我尝试添加索引时,出现401错误。代码如下:
class Program
{
static void Main(string[] args)
{
using (var documentStore = new DocumentStore() { Url = "http://localhost:8080" })
{
documentStore.Initialise();
documentStore.DatabaseCommands.PutIndex(
"BasicEntityBySomeData",
new IndexDefinition<BasicEntity, BasicEntity>()
{
Map = docs => from doc in docs
where doc.SomeData != null
select new
{
SomeData = doc.SomeData
},
});
string entityId;
using (var documentSession = documentStore.OpenSession())
{
var entity = new BasicEntity()
{
SomeData = "Hello, World!",
SomeOtherData = "This is just another property",
};
documentSession.Store(entity);
documentSession.SaveChanges();
entityId = entity.Id;
var loadedEntity = documentSession.Load<BasicEntity>(entityId);
Console.WriteLine(loadedEntity.SomeData);
var docs = documentSession.Query<BasicEntity>("BasicEntityBySomeData")
.Where("SomeData:Hello~")
.WaitForNonStaleResults()
.ToArray();
docs.ToList().ForEach(doc => Console.WriteLine(doc.SomeData));
Console.Read();
}
}
}
它在引发PutIndex()调用的线上时会引发401错误。任何想法我需要申请什么权限?我需要在哪里应用它们?
我觉得继续之前预期我应该在这里添加一个免责声明,虽然我一直在撰写有关该主题的博客文章,但我不是* RavenDB应该如何操作或功能的专家 - 并且只知道我在使用它的过程中发现的内容到目前为止 - 这可能比大多数人更多,因为迄今为止我使用它的人比大多数人都多,但不足以说,写这个的人(奥伦) – 2010-05-13 20:26:46
嗨,罗布,谢谢你的回答,以及真正详细的博客文章 - 好东西!我有一个总共1小时的RavenDB经验,所以你比我更专业。 目前,我通过将Raven/AnonymousAccess键设置为“All”来让自己启动并运行。我相信这不是一个长期的解决方案,但足以让我度过这个坎坷,所以我可以做一些实验。 – dalesmithtx 2010-05-13 22:43:44
这应该是Raven.Server中的默认设置 - 道歉没有明确提及它 – 2010-05-13 22:48:53