【发布时间】:2012-08-11 01:10:23
【问题描述】:
我开始学习 RavenDB。我在服务器机器上安装了服务器版本,并将客户端 dll 添加到一个简单的控制台应用程序中。当我尝试运行应用程序时,它给了我一个 WebException:“请求被中止:请求被取消。”
代码如下:
public class Article : AbstractIndexCreationTask<Article>
{
public string Id { get; set; }
public string Text { get; set; }
public string Title { get; set; }
public Article()
{
Map = articles => from article in articles select new { article.Text };
}
}
static void Main(string[] args)
{
var ravenIntroArticle = new Article()
{
Text = "RavenDB fits into a movement that is called ...",
Title = "RavenDB Introduction",
};
var csharpUsingArticle = new Article()
{
Text = "The full value of the C# using statement ...",
Title = "Your Friend the C# Using Statement",
};
var nutsAndProteinArticle = new Article()
{
Text = "Nuts are a great source of protein ...",
Title = "Nuts and Protein",
};
using (IDocumentStore documentStore = new DocumentStore() { Url = "http://rtest01:8081" })
{
documentStore.Initialize();
using (IDocumentSession session = documentStore.OpenSession())
{
session.Store(ravenIntroArticle); // the exception happens here
session.Store(csharpUsingArticle);
session.Store(nutsAndProteinArticle);
session.SaveChanges();
}
}
当我尝试在本地服务器“http://localhost:8080”上运行它时会发生以下情况
你能告诉我缺少什么吗?
谢谢。
【问题讨论】:
-
我们需要更多信息,例如:服务器是否在 IIS 中运行?如果是这种情况,那么您可能需要调整权限,并在 raven.server.config 中将其从“获取”更改为“全部”。
-
请看我编辑后的图片。
-
机器之间有防火墙吗?什么是安全设置?当你在一台机器上运行它时会发生什么?
-
我应该可以连接到服务器了。其实我可以通过Studio访问服务器上的示例数据:rtest01:8081/raven/studio.html#/home?database=Default
-
我在本地主机上试过了。请查看我更新的问题。