title: Azure - ASP.NET MVC connect to mysql database
body: <p>Actually, i wanted to check is my connection string valid.</p>
  
  <p>There are asp.net mvc web app and mysql db deployed on azure, so i want use second thing in first. So, i added db to visual studio server explorer - db and all tables are visible.</p>
  
  <p>Now i tried to add connectionstring to my project, and, wow, there are two of them i found:
  First: In Visual studio data connection properties:</p>
  
  <pre><code>server=us-cdbr-azure-central-a.cloudapp.net;user id=userid;persistsecurityinfo=True;database=crawlerdb
  </code></pre>
  
  <p>Second: In azure workplace's database property:</p>
  
  <pre><code>Database=CrawlerDB;Data Source=us-cdbr-azure-central-a.cloudapp.net;User Id=userid;Password=userpass
  </code></pre>
  
  <p>And both of them doesn't work. Never lucky.
  Connection state checking code:</p>
  
  <pre><code>using (SqlConnection conn = new SqlConnection(connstr))
          {
              try
              {
                  conn.Open();
                  var q = conn.State;
              }
              catch(Exception ex)
              {
                  var q = ex.Message;
              }
          }
  </code></pre>
  
  <p>What am i doing wrong?:) Tell me plz:)</p>
  
  <hr>
  
  <pre><code>public class CrawledDataContext : DbContext
  {
      public CrawledDataContext()
      {
          Database.SetInitializer&lt;CrawledDataContext&gt;(null);
          using (SqlConnection conn = new SqlConnection("server=us-cdbr-azure-central-a.cloudapp.net;user id=bb15193d20f901;persistsecurityinfo=True;database=crawlerdb"))
          {
              try
              {
                  conn.Open();
                  var q = conn.State;
              }
              catch(Exception ex)
              {
                  var q = ex.Message;
              }
          }
      }
      public DbSet&lt;GroupInfo&gt; GroupInfoes { get; set; }
  }
  </code></pre>
  
  <p>Here is exception message:</p>
  
  <p>"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"</p>