title: Why is my Application trying to create a local SQL Server Express database when I add a user to a role?
body: <p>I am running the code locally, and I have a database setup on a 3-rd party SQL Server and it has 5 tables for UserProfiles/Roles/Membership. I am trying to simply add a user to a role.  </p>
  
  <p>Below is my code for that simple exchange:</p>
  
  <pre><code>namespace InSight.Controllers
  {
  public class AdminController : Controller
  {
  //
  // GET: /Admin/
  public ActionResult Index()
  {
  Roles.AddUserToRole("schumacherj","Administrator");
  return View();
  }
  
  }
  }
  </code></pre>
  
  <p>The error that I receive when trying to access the Administrator controller with the offending code: </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</p>
    
    <blockquote>
      <p>Network Interfaces, error: 26 - Error Locating Server/Instance Specified)</p>
    </blockquote>
    
    <p>Description: An unhandled exception occurred during the execution of
    the current web >request. Please review the stack trace for more
    information about the error and where it >originated in the code. </p>
    
    <p>SQLExpress database file auto-creation error: </p>
    
    <p>The connection string specifies a local Sql Server Express instance
    using a database >location within the application's App_Data
    directory. The provider attempted to >automatically create the
    application services database because the provider determined >that
    the database does not exist. The following configuration requirements
    are necessary >to successfully check for existence of the application
    services database and automatically >create the application services
    database:</p>
  </blockquote>
  
  <p>EDIT: </p>
  
  <p>So.... I asked much too soon.</p>
  
  <p>I followed the advice in this answer:
  <a href="https://stackoverflow.com/questions/1746068/godaddy-asp-net-membership-database-woes">Godaddy ASP.NET membership database woes</a></p>
  
  <p>Then I made a mistake and followed this one's advice:
  <a href="http://forums.asp.net/t/982572.aspx" rel="nofollow noreferrer">http://forums.asp.net/t/982572.aspx</a></p>
  
  <p>I hope this helps someone besides me.</p>