更新时间:2022-02-18 04:44:01
这的教程如何设置SQL Server 2008中的IIS 7.0上ASP.net网站给我带来接近的解决方案。
This tutorial how to setup SQL Server 2008 for an ASP.net website on IIS 7.0 brought me close to the solution.
基本上,你需要做的就是
Basically, what you need to do is
更改我的连接字符串的名称帮我终于建立连接。
Changing the name of my connection string helped me establish the connection finally.
<connectionStrings>
<add name="MyProjectContext" connectionString="Server=.\SQLEXPRESS;Database=MyProject;User Id=John;Password=duck;" providerName="System.Data.SqlClient" />
</connectionStrings>
上下文模型所需要这个名字。
The context model required this name.
public class MyProjectContext : DbContext
{
public MyProjectContext() : base("name=MyProjectContext")
{
}
public DbSet<Model1> Model1 { get; set; }
public DbSet<Model2> Model2 { get; set; }
}