title: ASP.net: Cannot use Website Administration Tool because of database error
body: <p>This is my first project using ASP.net and I'm struggling to get my database connection working.
  Right now the database for my application data is working and I can use the website to do simple CRUD operations.
  However, when I try to add Authorizarion and Authentication via the Web Site Administration Tool I get the following exception:
  <strong>Cannot open user default database. Login failed. Login failed for user 'PcName\UserName'.</strong></p>
  
  <p>I have tried solving this problem by using different connection strings, but without luck. They would just break my website functionality.</p>
  
  <p>My connection string is:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="ProjectEntities"
       connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
                         database=ProjectDB;
                         AttachDBFilename=|DataDirectory|aspnetdb.mdf;
                         User Instance=true"
       providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>I'm using Visual Studio 2010, with ASP.net MVC 3 and the Entity Framework.</p>
  
  <p>I'm really out of options here, there is way too much information about SQL Server Express and ASP.net and I just can't find any working solution.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I tried several different connection strings as suggested below and found online. I now have a different error when trying to load the Web Site Administration Tool: <strong>Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.</strong></p>
  
  <p>When Googling that I found some solutions to fix that problem. One of those was to run aspnet_regsql.exe with some option. When doing that I get the following error message:</p>
  
  <pre><code>An error has occurred. Details of the exception:
  A network-related or instance-specific error occurred while establishing a conne
  ction 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 conne
  ction to SQL Server)
  
  Unable to connect to SQL Server database.
  </code></pre>
  
  <p>Somehow it seems that the SQL server is not running, or something. My knowledge about this subject is really insufficient to fix this problem.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>I've done some more research and just tried to run the Web Site Administration Tool of an newly created MVC 3 Internet Application. When going to the security tab it gives me a different error: <strong>Could not load type 'MvcApplication1.MvcApplication'.</strong></p>
  
  <p>So my guess is that I'm missing some configurations in Web.config in my initial project (created as empty project), but somehow there is a new problem...</p>