Connection string between IIS and SQL server

asp.net-mvc entity-framework iis sql-server

Accepted Answer

I almost found the answer thanks to the This instruction on how to set up SQL Server 2008 for an ASP.net website on IIS 7.0.

Essentially, all you must do is

  1. Set up a SQL server.
  2. Permit connections to the SQL server across TCP/IP.
  3. Include a database.
  4. Set up a login. SQL Authentication is what I use.
  5. Give your database the user rights that you want.
  6. Create the connection string for your database.

I was ultimately able to establish the connection by changing the name of my connection string.

<connectionStrings>
       <add name="MyProjectContext" connectionString="Server=.\SQLEXPRESS;Database=MyProject;User Id=John;Password=duck;" providerName="System.Data.SqlClient" />
</connectionStrings>

This name was necessary for the context model.

public class MyProjectContext : DbContext
{

    public MyProjectContext() : base("name=MyProjectContext")
    {
    }

    public DbSet<Model1> Model1 { get; set; }
    public DbSet<Model2> Model2 { get; set; }
}
2
12/13/2013 7:56:33 AM

Popular Answer

Get additional information about the 500 error by using the Viewing Events.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow