【发布时间】:2012-03-03 16:19:20
【问题描述】:
我正在使用 Entity Framework Code First 4.3 + Azure 并且无法连接到数据库。我得到的错误如下(在第一个查询中):
Keyword not supported: 'server'.
我在我的 Web.config 中设置了以下连接
<configSections>
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<connectionStrings>
<add name="TestDBContext"
connectionString="Server=tcp:[SUBSCR].database.windows.net,1433;Database=[MyDB];User ID=[user];Password=[pass];Trusted_Connection=False;Encrypt=True;PersistSecurityInfo=True"
providerName="System.Data.EntityClient" />
</connectionStrings>
我的 DbContext 实现类使用连接字符串的名称:
public class MyContext : DbContext, IMyContext
{
public MyContext()
: base("TestDBContext")
{
Configuration.LazyLoadingEnabled = true;
Configuration.ProxyCreationEnabled = true;
}
你能告诉我发生了什么吗?
【问题讨论】:
标签: entity-framework azure ef-code-first connection-string code-first