title: SQL Connection class won't connect when run from a Blazor App
body: <p>I am trying to use the following code to query a database from a Blazor web page, the exception is as follows</p>
  
  <blockquote>
    <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: SQL Network Interfaces, error: 44 - Could not compose Service Principal Name (SPN) for Windows Integrated Authentication. Possible causes are server(s) incorrectly specified to connection API calls, Domain Name System (DNS) lookup failure or memory shortage)</p>
    
    <p>System.PlatformNotSupportedException: System.Net.Dns:GetHostByName is not supported on this platform.</p>
    
    <p>at System.Net.Dns.GetHostByName (System.String hostName) &lt;0x38c58e8 + 0x0001c> in :0 
    ...</p>
  </blockquote>
  
  <p>When I run the same code in a traditional web or console app the connection opens/closes instantly.</p>
  
  <pre><code>public class MySQLHelper
  {
      public static SqlConnection GetConnection()
      {           
          string m_connectionString = "connection string here";
          SqlConnection sqlConn = new SqlConnection(m_connectionString);
          sqlConn.Open(); // fails to open when called from a regular registered 'service' in Blazor
  
          return sqlConn;
      }
  }
  </code></pre>
  
  <p>Thoughts?</p>