实体框架:“底层提供者在打开时失败"; [英] Entity Framework : "The underlying provider failed on Open"

查看:38
本文介绍了实体框架:“底层提供者在打开时失败";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试插入记录时,出现此错误:基础提供程序在打开时失败.仅使用IIS会发生此错误,而VWD 2008的Web服务器不会发生此错误.在EventViewer中,我收到此应用程序错误:由于无法启动SQL Server用户实例,原因是该用户实例的启动过程失败.连接将关闭.[客户:]

When I try to insert a record, I get this error : The underlying provider failed on Open. This error occurs only with IIS and not with VWD 2008's webserver. In the EventViewer I get this Application Error : Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed. [CLIENT: ]

<add name="ASPNETDBEntities"
     connectionString="
         metadata=res://*/Models.FriendList.csdl|res://*/Models.FriendList.ssdl|res://*/Models.FriendList.msl;
         provider=System.Data.SqlClient;
         provider connection string=&quot;
         Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;
         Integrated Security=True;
         Connect Timeout=30;
         User Instance=True;
         MultipleActiveResultSets=True&quot;"
     providerName="System.Data.EntityClient" />

我正在使用aspnetdb.mdf文件,而不是任何外部数据库.我已经为此进行了足够的搜索,但没有用.

I am using aspnetdb.mdf file, and not any external database. I have searched enough for this, but no use.

VWD网络服务器一切正常

推荐答案

您应该为Web服务器创建一个sql帐户,以访问aspnetdb数据库.目前,它正在使用集成身份验证(尝试使用Web服务器用来运行该应用程序的身份登录).

You should create a sql account for your web server to access the aspnetdb database. It is currently using integrated authentication (tries to logon with the identity the web server is using to run the application).

以下示例使用集成身份验证.我会使用SQL身份验证.

The example below uses integrated auth. I would use SQL auth though.

http://msdn.microsoft.com/en-us/library/ff649314.aspx

这篇关于实体框架:“底层提供者在打开时失败";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆