不确定我为什么会收到此错误。这是一个练习代码,所以我学习了实体框架代码的第一种方法。
我在web.config中有以下内容
<add name="CompanyDBContext"
connectionString="server=.; database=CompanyDB;integrated security=true;"
providerName="System.Data.SqlClient"/>
<connectionStrings>
和以下课程
public class CompanyDBContext: DbContext
{
public DbSet<Department> Departments { get; set; }
public DbSet<Employee> Employees { get; set; }
}
错误是:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
提前致谢!
答案 0 :(得分:0)
连接字符串格式错误。正确的是:
<connectionStrings>
<add name="CompanyDBContext"
connectionString="server=.; database=CompanyDB;integrated security=true;"
providerName="System.Data.SqlClient"/>
</connectionStrings>