初始化字符串的格式部署后连接到Azure DB时出错。在当地工作正常

时间:2013-04-29 02:29:29

标签: asp.net-mvc azure entity-framework-5 azure-sql-database

* SOVLED:我的密码中有%可以从本地计算机运行。重置密码并将%更改为#,它工作正常! *

我有一个使用EF和Azure的MVC 4应用程序。我可以从本地计算机上连接并运行指向Azure数据库的应用程序,但它不能在部署时运行。我收到以下错误: 初始化字符串的格式不符合从索引 130 开始的规范。

请注意,我的错误表明索引130,而所有其他报告的此错误状态实例的索引为0。

我不确定发生了什么。有人有想法吗?我一直在寻找一段时间,但我没有提出任何有用的东西。

我首先使用代码EF。

连接字符串的Web配置:

  <connectionStrings>
    <clear/>
    <add name="my_db" connectionString="Data Source=tcp:server.database.windows.net,1433;Initial Catalog=my_db;User ID=mydblogin@server;Password=password" providerName="System.Data.SqlClient" />
  </connectionStrings>

相关堆栈跟踪:

[ArgumentException: Format of the initialization string does not conform to specification starting at index 130.]
   System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5312764
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +124
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
   System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential) +26
   System.Data.SqlClient.SqlConnection..ctor(String connectionString) +6
   System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(String nameOrConnectionString) +216
   System.Data.Entity.Infrastructure.LocalDbConnectionFactory.CreateConnection(String nameOrConnectionString) +282
   System.Data.Entity.Internal.LazyInternalConnection.Initialize() +301
   System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName() +13
   System.Data.Entity.Internal.LazyInternalContext.get_ProviderName() +11
   System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context) +101
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +352
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
   System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63

0 个答案:

没有答案