C# 键“attachdbfilename”+实体框架的值无效

C# 键“attachdbfilename”+实体框架的值无效,c#,asp.net-mvc,entity-framework,asp.net-web-api,C#,Asp.net Mvc,Entity Framework,Asp.net Web Api,我正在做一个MVCWebAPI项目 我在开发环境上有以下连接字符串: <add name="ContextoIsolucionV4" providerName="System.Data.SqlClient" connectionString="Data Source=WOLVERINE\SQLEXPRESS;Initial Catalog=Isolucion40DesarrolloMC;password=isolucion; User=isolucion; MultipleActiveRe

我正在做一个MVCWebAPI项目

我在开发环境上有以下连接字符串:

<add name="ContextoIsolucionV4" providerName="System.Data.SqlClient" connectionString="Data Source=WOLVERINE\SQLEXPRESS;Initial Catalog=Isolucion40DesarrolloMC;password=isolucion; User=isolucion; MultipleActiveResultSets=True" />
完整的堆栈跟踪是:

{消息:发生错误,。异常消息:键'attachdbfilename'的值无效,异常类型:System.ArgumentException,StackTrace:at System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixupString&host,Boolean enforceLocalHost,Boolean fixup\r\n at System.Data.SqlClient.SqlConnectionString..connectionString连接字符串\r\n在System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptionString connectionString中,在System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroupString连接字符串中,在System.Data.SqlClient.SqlCon中,前面的DbConnectionOptions\r\n中,前面的DbConnectionOptions和userConnectionOptionsconnection.ConnectionString\u SetString值\r\n位于System.Data.SqlClient.SqlConnection.set\u ConnectionString值\r\n位于System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b\u 18DbConnection t,DbConnectionPropertyInterceptionContext1 c\r\n位于System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatcher[TTarget,TInterceptionContext]t在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionStringDBConnectionConnection连接,DbConnectionPropertyInterceptionContext1 interceptionContext在System.Data.Entity.Infrastructure.SqlConnec上\r\n执行目标目标,Action2操作,TInterceptionContext interceptionContext,Action3执行,Action3执行位于System.Data.Entity.Infrastructure.LocalDbConnectionFactory.CreateConnectionString名称或连接字符串\r\n位于System.Data.Entity.Internal.LazyInternalConnection.Initialize\r\n位于System.Data.Entity.Internal.LazyInternalConnection.get\r\n位于System.Data.Entity.IInternal.LazyInternalContext.get\u ProviderName\r\n位于System.Data.Entity.Internal.DefaultModelCacheKeyFactory.CreateDbContext上下文\r\n位于System.Data.Entity.Internal.LazyInternalContext.InitializeContext\r\n位于System.Data.Entity.InternalContext.GetEntitySetAndBaseTypeForTypeType entityType\r\n位于System.Data.Entity.Internal.Linq.InternalSet1.Initialize\r\n at System.Data.Entity.Internal.Linq.InternalSet1.get\u InternalContext\r\n at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get\u Provider\r\n at System.Linq.Queryable.FirstOrDefault[TSource]IQueryable1源,表达式1谓词\r\n位于Isolucion.Aplicacion.implementacions.servicioapplicacionusuario.autenticatarString nombreUsuario,字符串反义\r\n位于Isolucion.Servicios.WebApi.Controllers.UsuarioController.LoginLoginDto\r\n位于lambda_methodClosure,Object,Object[]\r\n位于System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.c__DisplayClass13.b__cObject实例,对象[]方法参数\r\n位于System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.ExecuteObject实例,对象[]参数\r\n位于System.Web.Http.Controllers.ReflectedHttpActionDescriptor.c_uuDisplayClass5.b_uu4\r\n位于System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult]Func1 func,CancellationToken CancellationToken}

有什么建议吗?这是因为我使用的是实体框架6


Help!!

您的上下文似乎没有使用该SQL连接字符串。您的web.config中还有其他连接字符串吗?这不是实体连接字符串。请将您的连接字符串设置为EF文档。请查看该字符串,以解决问题…问题是连接字符串的名称与所使用的名称不匹配在这种情况下…无论如何谢谢你的帮助。。。
ExceptionType: "System.ArgumentException"
Message: "An error has occurred."
StackTrace: "   at System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup)
↵   at System.Data.SqlClient.SqlConnectionString..ctor(String connect