我有一个使用EF从SQL数据库检索数据的服务。实体框架“底层提供程序在打开时失败” - 卡西尼vs IIS
EF模型位于类库中。在类库中,连接配置为:
<add name="APIC2CEntities"
connectionString="metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MYSERVER;initial catalog=MYDB;user id=MYUSER;password=THEPASSWORD;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
此类库由WCF服务项目引用。在webconfig我控制与EF连接:
<add name="APIC2CEntities"
connectionString="metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MYSERVER;initial catalog=MYDB;user id=MYUSER;password=THEPASSWORD;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
当我的服务是在卡西尼运行数据被正确检索。当服务IIS(Windows XP中)下运行的连接失败,出现以下异常:
The underlying provider failed on Open
与内部异常告诉我:
{"A network-related or instance-specific error occurred while establishing a connection 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 connection to SQL Server)"}
我明白,卡西尼号在我的记录中运行帐户,并且该IIS正在IUSR_MYMACHINE帐户下运行,但我的连接不受信任,所以此不应该问题...
EF如何以其他方式操纵或控制EF连接IIS和Cassini之间?
谢谢,
马克
该问题似乎与EF没有关系......您可以直接使用ADO.NET打开连接吗? – 2011-05-03 09:17:13
所有应该处理的事项都是进程标识和用于连接的凭证 - 除了标识以外,Cassini或IIS是否正在执行都没有区别 – BrokenGlass 2011-05-03 13:08:33