我正在制作一个MVC WEB API项目。
我在开发环境中有以下连接字符串:
<add name="ContextoIsolucionV4" providerName="System.Data.SqlClient" connectionString="Data Source=WOLVERINE\SQLEXPRESS;Initial Catalog=Isolucion40DesarrolloMC;password=isolucion; User=isolucion; MultipleActiveResultSets=True" />
当我向ApiController发布并测试网站(发出AJAX请求)时,返回以下异常:
ExceptionMessage:“键'attachdbfilename'的值无效。”
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
完整的堆栈跟踪是:
{“Message”:“发生错误。”,“ExceptionMessage”:“键'attachdbfilename'的值无效。”,“ExceptionType”:“System.ArgumentException”,“StackTrace”:“at System.Data .SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String&amp; host,Boolean enforceLocalHost,Boolean fixup)\ r \ n在System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)\ r \ n在System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions (String connectionString,DbConnectionOptions上一个)\ r \ n在System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString,DbConnectionPoolGroupOptions poolOptions,DbConnectionOptions&amp; userConnectionOptions)\ r \ n在System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) \ r \ n在System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)\ r \ n在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__18(DbConnection t,DbConnectionPropertyInterceptionContext
1 c)\r\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher
1.Dispatch [TTarget,TInterceptionContext](TTarget目标,Action2 operation, TInterceptionContext interceptionContext, Action
3执行,Action3 executed)\r\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(DbConnection connection, DbConnectionPropertyInterceptionContext
1 interceptionContext)\ r \ n在System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(String nameOrConnectionString) \ r \ n在System.Data.Entity.Infrastructure.LocalDbConnectionFactory.CreateConnection(String nameOrConnectionString)\ r \ n,在System.Data.Entity.Internal的System.Data.Entity.Internal.LazyInternalConnection.Initialize()\ r \ n中System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)\ r \ n在System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()\ r \ n的.LazyInternalConnection.get_ProviderName()\ r \ n System.Data.Entity.InternalSet {{System.Data.Entity.InternalSet {{ 1}} 1.get_InternalContext()\ r \ n在System.Data.Entity.Infrastructure.DbQuery1.Initialize()\r\n at System.Data.Entity.Internal.Linq.InternalSet
1来源,表达式{{1 1 func,CancellationToken cancellationToken)“}
有什么建议吗?这是因为我使用实体框架6 ??
帮助!!