title: System.Data.EntityException: The underlying provider failed on Open
body: <p>I am building an application which has a database on the server machine and I am using this method for database access: </p>
  
  <pre><code>public static string GetDefaultConnectionString()
  {
      //get my db info from ini file
      dbinfo DatabaseInfo = new dbinfo();
      DatabaseInfo = GetDatabaseInfo();
      if (DatabaseInfo.dbName == "" || DatabaseInfo.Password == "" || DatabaseInfo.Server == "" || DatabaseInfo.UserId == "")
      {
          throw new Exception("Database config file is not valid");
      }
      else
      {
          MessageBox.Show("Db name " + DatabaseInfo.dbName);
          MessageBox.Show("User " + DatabaseInfo.UserId);
          MessageBox.Show("Db Pass " + DatabaseInfo.Password);
          MessageBox.Show("Db Server " + DatabaseInfo.Server);
      }
      string conStrIntegratedSecurity = new System.Data.EntityClient.EntityConnectionStringBuilder
      {
          Metadata = "res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl",
          Provider = "System.Data.SqlClient",
          ProviderConnectionString = new System.Data.SqlClient.SqlConnectionStringBuilder
          {
              InitialCatalog = DatabaseInfo.dbName,
              DataSource = DatabaseInfo.Server,
              IntegratedSecurity = true,
              UserID = DatabaseInfo.UserId,
              Password = DatabaseInfo.Password,
              MultipleActiveResultSets = true,
              ConnectTimeout = 0,
              MaxPoolSize = 500,
          }.ConnectionString
      }.ConnectionString;
      //MessageBox.Show(conStrIntegratedSecurity);
      return conStrIntegratedSecurity;
  }
  </code></pre>
  
  <p>and it works fine in server pc.
  But, when I install this application on any client machine, it cannot open a connection and it gives the following error message: </p>
  
  <pre><code>System.Data.EntityException: The underlying provider failed on Open. ---&gt; 
  System.Data.SqlClient.SqlException: Cannot open database "dbName" requested by the login. The login failed.
  Login failed for user 'ServerName\User'.
  </code></pre>
  
  <p>Does anyone know why this is happening?</p>