问题描述
用户代码未处理System.Data.ProviderIncompatibleExceptionHResult=-2146233087Message=提供程序未返回ProviderManifestToken字符串。Source=System.Data.EntityStackTrace:在System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnectionconnection)在System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnectionconnection,DbProviderManifest&providerManifest)在System.Data.Entity.DbModelBuilder.Build(DbConnectionproviderConnection)在System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContextinternalContext)在System.Data.Entity.Internal.RetryLazy`2.GetValue(TInputinput)在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()在System.Data.Entity.Internal.InternalContext.Initialize()在System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(TypeentityType)在System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()在System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()在System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()在System.Linq.Queryable.Where[TSource](IQueryable`1source,Expression`1predicate)在MyDemo.Controllers.MoviesController.Index()位置E:vs2010MyDemoMyDemoControllersMoviesController.cs:行号20在lambda_method(Closure,ControllerBase,Object[])在System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBasecontroller,Object[]parameters)在System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContextcontrollerContext,IDictionary`2parameters)在System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContextcontrollerContext,ActionDescriptoractionDescriptor,IDictionary`2parameters)在System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()在System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilterfilter,ActionExecutingContextpreContext,Func`1continuation)InnerException:System.Data.SqlClient.SqlExceptionHResult=-2146232060Message=在与SQLServer建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且SQLServer已配置为允许远程连接。(provider:NamedPipesProvider,error:40-无法打开到SQLServer的连接)Source=.NetSqlClientDataProviderErrorCode=-2146232060Class=20LineNumber=0Number=3Server=""State=0StackTrace:在System.Data.SqlClient.SqlInternalConnection.OnError(SqlExceptionexception,BooleanbreakConnection,Action`1wrapCloseInAction)在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjectstateObj,BooleancallerHasConnectionLock,BooleanasyncClose)在System.Data.SqlClient.TdsParser.Connect(ServerInfoserverInfo,SqlInternalConnectionTdsconnHandler,BooleanignoreSniOpenTimeout,Int64timerExpire,Booleanencrypt,BooleantrustServerCert,BooleanintegratedSecurity,BooleanwithFailover)在System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfoserverInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanignoreSniOpenTimeout,TimeoutTimertimeout,BooleanwithFailover)在System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfoserverInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance,SqlConnectionStringconnectionOptions,SqlCredentialcredential,TimeoutTimertimeout)在System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimertimeout,SqlConnectionStringconnectionOptions,SqlCredentialcredential,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance)在System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentityidentity,SqlConnectionStringconnectionOptions,SqlCredentialcredential,ObjectproviderInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance,SqlConnectionStringuserConnectionOptions,SessionDatareconnectSessionData)在System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptionsoptions,DbConnectionPoolKeypoolKey,ObjectpoolGroupProviderInfo,DbConnectionPoolpool,DbConnectionowningConnection,DbConnectionOptionsuserOptions)在System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPoolpool,DbConnectionowningObject,DbConnectionOptionsoptions,DbConnectionPoolKeypoolKey,DbConnectionOptionsuserOptions)在System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionowningObject,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection)在System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionowningObject,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection)在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnectionowningObject,UInt32waitForMultipleObjectsTimeout,BooleanallowCreate,BooleanonlyOneCheckConnection,DbConnectionOptionsuserOptions,DbConnectionInternal&connection)在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnectionowningObject,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions,DbConnectionInternal&connection)在System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnectionowningConnection,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection,DbConnectionInternal&connection)在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnectionouterConnection,DbConnectionFactoryconnectionFactory,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions)在System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnectionouterConnection,DbConnectionFactoryconnectionFactory,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions)在System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1retry)在System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1retry)在System.Data.SqlClient.SqlConnection.Open()在System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnectionsqlConnection,Action`1act)在System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnectionsqlConnection,Action`1act)在System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnectionconnection)在System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnectionconnection)InnerException:System.ComponentModel.Win32ExceptionHResult=-2147467259Message=系统找不到指定的路径。ErrorCode=-2147467259NativeErrorCode=3InnerException:
解决方案
解决方案二:
链接数据库有问题。
解决方案三:
链接数据库有问题,怎么解决?
解决方案四:
在与SQLServer建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且SQLServer已配置为允许远程连接。
解决方案五:
先把web.config里的字符串配置,拿出来放到sql中看看能不能登录