首页新闻找找看学习计划

项目中使用 EF6.0, 初始化数据库时偶尔报错。。。。。。求解决!!!

0
悬赏园豆:10 [已解决问题] 解决于 2017-02-27 09:09

The underlying provider failed on Open., at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable`1 sequence)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)

一切平常心的主页 一切平常心 | 初学一级 | 园豆:180
提问于:2016-11-21 14:12
< >
分享
最佳答案
0

若不行依次尝试如下几种解决方案
(1)在连接字符串中添加【 MultipleActiveResultSets=True"】
(2)进行第一种方案还是不行请尝试第二种,连接字符串中存在【user Instance=true】请移除
(3)若第二种方案不行,请尝试第三种,利用命令行进行如下命令 netsh Winsock reset

收获园豆:10
Jeffcky | 老鸟四级 |园豆:2544 | 2016-11-21 14:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册