Visual studio 2013 EntityFramework.dll中发生System.Data.DataException错误

Visual studio 2013 EntityFramework.dll中发生System.Data.DataException错误,visual-studio-2013,asp.net-mvc-5,sql-server-express,entity-framework-6,localdb,Visual Studio 2013,Asp.net Mvc 5,Sql Server Express,Entity Framework 6,Localdb,我一直在学习这个教程 当我到达需要运行程序的部分并单击Student以便程序创建数据库时,我得到以下错误 用户代码未处理System.Data.DataException HResult=-2146233087 Message=初始化数据库时发生异常。有关详细信息,请参见InnerException。 Source=EntityFramework 堆栈跟踪: 位于System.Data.Entity.Internal.InternalContext.PerforminizationAction

我一直在学习这个教程

当我到达需要运行程序的部分并单击Student以便程序创建数据库时,我得到以下错误

用户代码未处理System.Data.DataException HResult=-2146233087 Message=初始化数据库时发生异常。有关详细信息,请参见InnerException。 Source=EntityFramework 堆栈跟踪: 位于System.Data.Entity.Internal.InternalContext.PerforminizationAction(操作操作) 位于System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()处 位于System.Data.Entity.Internal.LazyInternalContext.b_uu4(InternalContext c) 在System.Data.Entity.Internal.RetryAction
1.PerformAction(输入输入)
位于System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action
1 Action) 在System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()中 位于System.Data.Entity.Internal.InternalContext.Initialize()处 位于System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型entityType) 在System.Data.Entity.Internal.Linq.InternalSet
1.Initialize()处
位于System.Data.Entity.Internal.Linq.InternalSet
1.GetEnumerator() 在System.Data.Entity.Infrastructure.DbQuery
1.System.Collections.Generic.IEnumerable.GetEnumerator()中
位于System.Collections.Generic.List
1..ctor(IEnumerable
1集合)
at System.Linq.Enumerable.ToList[t源](IEnumerable
1源) 在c:\Users\Office\Documents\Visual Studio 2013\Projects\ContosUniversityFollow\ContosUniversityFollow\Controllers\StudentController.Index()中的ContosUniversityFollow.Controllers.StudentController.Index()处:第21行 在lambda_方法中(闭包、控制器基、对象[]) 位于System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller,Object[]参数) 在System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext ControllerContext,IDictionary
2个参数)
位于System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext ControllerContext、ActionDescriptor ActionDescriptor、IDictionary
2个参数) 在System.Web.Mvc.Async.AsyncControllerActionInvoker.ActionInvoke.InvokeSynchronousActionMethod()中 在System.Web.Mvc.Async.AsyncControllerActionInvoker.b_u36(IAsyncResult asyncResult,ActionInvokeInnerInvokeState) 位于System.Web.Mvc.Async.AsyncResultRapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult)
在System.Web.Mvc.Async.AsyncResultRapper.WrappedAsyncResultBase上
在System.Web.Mvc.Async.asyncResultRapper.End[TResult](IAsyncResult asyncResult,对象标记)
位于System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3c()中
在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass45.b__3e()中
InnerException:System.Data.Entity.Core.EntityException
HResult=-2146233087
Message=基础提供程序在打开时失败。
Source=EntityFramework
堆栈跟踪:
在System.Data.Entity.Core.EntityClient.EntityConnection.Open()中
位于System.Data.Entity.Core.Objects.ObjectContext.EnsureReconnection()处
在System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func
1 Func,IDbExecutionStrategy executionStrategy,Boolean startLocalTransaction,Boolean releaseConnectionOnSuccess)
在System.Data.Entity.Core.Objects.ObjectQuery中
在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func
1操作)
位于System.Data.Entity.Core.Objects.ObjectQuery
1.GetResults(Nullable
1 forMergeOption)
在System.Data.Entity.Core.Objects.ObjectQuery中
在System.Lazy
1.CreateValue()中
at System.Lazy
1.LazyInitValue() 在System.Lazy
1.get_Value()处
在System.Data.Entity.Internal.LazyEnumerator中
在System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1源代码)处
位于System.Data.Entity.Core.Objects.elink.ObjectQueryProvider.b__1[TResult](IEnumerable
1序列) 在System.Data.Entity.Core.Objects.Elink.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable
1查询,表达式queryRoot)
位于System.Data.Entity.Core.Objects.Elink.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](表达式)
在System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](表达式)处
位于System.Linq.Queryable.FirstOrDefault[TSource](IQueryable
1源) 位于System.Data.Entity.Internal.EdmMetadataRepository.QueryForModelHash(Func
2 createContext)
位于System.Data.Entity.Internal.InternalContext.QueryForModelHash()处
位于System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext InternalContext、ModelHashCalculator ModelHashCalculator、Boolean ThrowFNMetadata)
位于System.Data.Entity.Internal.InternalContext.CompatibleWithModel(布尔ThrowifNMetadata)
位于System.Data.Entity.Database.CompatibleWithModel(布尔ThrowifNMetadata)
在System.Data.Entity.DropCreateDatabaseIfModelChanges中
1.初始化数据库(TContext上下文) 在System.Data.Entity.Internal.InternalContext.c_uuuDisplayClasse
1.b_uuud()中
位于System.Data.Entity.Internal.InternalContext.PerformInitia
public ActionResult Index()
{
    List<EmployeeDetail> employees = context.EmployeeDetails.ToList();
    List<Employee> emp = new List<Employee>();
    foreach(EmployeeDetail item in employees)
    {
        emp.Add(new Employee
            {
                ID=Convert.ToInt32(item.ID),
                Branch=item.Branch,`enter code here`
                Salary=Conve`enter code here`rt.ToInt32(item.Salary),
                UID = Convert.ToInt32(item.ID),
            });
    }
    return View(emp);
}
<div style="font-family:Arial">
        <h2>Index</h2>
        <ul>
            @foreach (var emp in Model)
            {
                <li>
                    @Html.ActionLink(emp.Branch, "Details", new { id = emp.ID });
                </li>
            }
        </ul>
    </div>