title: Error when opening an sql connection: 'MyConnection.ServerVersion' threw an exception of type 'System.InvalidOperationException'
body: <p>I have seen this problem in many posts, but cannot fix.. I'm trying to connect to a table in my SQL DB, using visual Studio 2015 (C#), and keep on getting an error.<br>
  This is my code (note: the connection string was taken from appsettings.json file):</p>
  
  <pre><code> string ConnectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=aspnet5-LicenseTool-b66aeae7-0f53-4987-8e86-6fba8a7f5e16;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
   using (SqlConnection MyConnection = new SqlConnection(ConnectionString))
   {
       // some code here 
   }
  </code></pre>
  
  <p>...
  when I run I get an error of:</p>
  
  <blockquote>
    <p>'MyConnection.ServerVersion' threw an exception of type
    'System.InvalidOperationException'</p>
  </blockquote>
  
  <p>See attachments of error and of server data - You can see I'm connected and I have correct parameters. </p>
  
  <p><a href="http://i.stack.imgur.com/WJIE9.jpg" rel="nofollow">Error Message</a></p>
  
  <p><a href="http://i.stack.imgur.com/ej3FB.png" rel="nofollow">Server</a></p>