title: Connection string for entity framework to connect to SQL High Availability servers
body: <p>I am developing an application using Entity Framework. In this application, the target database is a SQL 2012 High Availability Cluster Servers which has two members. One configured as primary, and the other as secondary.</p>
  
  <p>Trying to connect to the cluster using SQL Management Studio is fine. I could do query's and everything. The issue is when I try to connect it with my application. It will throw an exception with the message:</p>
  
  <pre><code>The target database ('UserDatabase') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online.
  </code></pre>
  
  <p>Checking more, the exception is thrown when the Entity Framework is trying to Open a connection to the database.</p>
  
  <p>Here is the connection string I am using:</p>
  
  <pre><code>data source=SQLCL01;initial catalog=UserDatabase;user id=test-user;password=##pass##;MultipleActiveResultSets=True
  </code></pre>
  
  <p>Since I know I could connect with the same credential perfectly using SQL Management Studio, I was wondering if the issue is with my connection string. Does anyone have similar experiences?</p>
  
  <p>Update:
  SQLCL01 is a listener. The DB instance name is SQLDB01 &amp; SQLDB02</p>