panjo
panjo

Reputation: 3515

RavenDb and target machine actively refuses

I'm following this tutorial to use ravenDb as my persistance object.

On controller when I tried to save passed values I've got following error

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

Global.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();
   }
}

I already tried with changing port number with 8081 or 8085 but either way error message is the same.

Here's my connection string section

 <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>

After Raven server been started everything is fine.

Upvotes: 2

Views: 1108

Answers (1)

Fitzchak Yitzchaki
Fitzchak Yitzchaki

Reputation: 9163

You need to make sure that RavenDB server is running, and using the same port as your application does.

In the connection string you specify the port of the server to connect to, but you probably did not run the RavenDB server itself.

Upvotes: 2

Related Questions