2

我正在按照本教程使用 ravenDb 作为我的持久性对象。

在控制器上,当我尝试保存传递的值时出现以下错误

> No connection could be made because the target machine actively
> refused it 127.0.0.1:8080

全球.asax.cs

public class MvcApplication : System.Web.HttpApplication
{
   public static IDocumentStore RavenDBDocumentStore { get; private set; }
   private static void CreateRavenDBDocumentStore()
   {
      RavenDBDocumentStore = new DocumentStore
      {     
         ConnectionStringName = "ravenDB"
      }.Initialize();
   }
   protected void Application_Start()
   {
      ...
      CreateRavenDBDocumentStore();
   }
}

我已经尝试使用8081or更改端口号,8085但任何一种方式的错误消息都是相同的。

这是我的连接字符串部分

 <connectionStrings>    
      <add name="DefaultConnection"
         providerName="System.Data.SqlClient"
         connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-RavenMvc-20121125145005;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-RavenMvc-20121125145005.mdf" />
         <add name="ravenDB"
         connectionString="Url=http://localhost:8085"/> 
  </connectionStrings>

Raven 服务器启动后一切正常。

4

1 回答 1

2

您需要确保 RavenDB 服务器正在运行,并且使用与您的应用程序相同的端口。

在连接字符串中,您指定要连接的服务器的端口,但您可能没有运行 RavenDB 服务器本身。

于 2013-05-29T07:43:08.250 回答