首页 > 解决方案 > 无法登录到 Azure 网站,但在本地服务器上正常

问题描述

初始化字符串的格式不符合从索引 116 开始的规范。

连接字符串是:-

connectionString="Server=tcp:*******.database.windows.net,1433;Initial Catalog=*******;Persist Security Info=True;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User ID=bill;Password="**************"" providerName="System.Data.SqlClient"

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[ArgumentException:初始化字符串的格式不符合从索引 116 开始的规范。]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +6047798
系统.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +127
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +100
System. Data.SqlClient.SqlConnectionString..ctor(字符串连接字符串)+61
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +169
System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +63
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +93 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__18(DbConnection t, DbConnectionPropertyInterceptionContext 1 c) +12 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(TTarget target, Action 2 operation, TInterceptionContext interceptionContext, Action3执行, Action 3 executed) +72 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(DbConnection connection, DbConnectionPropertyInterceptionContext1拦截上下文)+360
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) +269
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(字符串名称,AppConfig 配置) +32
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +129
System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName() +13 System.Data.Entity.Internal.LazyInternalContext.get_ProviderName() +11 System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext 上下文) +92
系统.Data.Entity.Internal.LazyInternalContext.InitializeContext() +515 System.Data.Entity.Internal.InternalContext.Initialize() +20 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +16
System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() +53 System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery 1.System.Linq.IQueryable.get_Provider() +38 System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 源,表达式1 predicate, CancellationToken cancellationToken) +138 System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 源,表达式1 predicate) +145 Microsoft.AspNet.Identity.EntityFramework.<GetUserAggregateAsync>d__67.MoveNext() +402 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64 Microsoft.AspNet.Identity.CultureAwaiter1.GetResult() +59 Microsoft.AspNet.Identity.Owin。 d__24.MoveNext() +309 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) +102
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) +64 Microsoft.AspNet.Identity.AsyncHelper.RunSync(Func 1 func) +160 Microsoft.AspNet.Identity.Owin.SignInManagerExtensions.PasswordSignIn(SignInManager2 manager , String userName, String password, Boolean isPersistent, Boolean shouldLockout) +127 Unisports.Account.Login.LogIn(Object sender, EventArgs e) in E:\Unisports\Unisports\Unisports\Account\Login.aspx.cs:37
系统。 Web.UI.WebControls.Button.OnClick(EventArgs e) +9794234
System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串 eventArgument)+211
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 eventArgument)+12
System.Web.UI.Page。 RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.d__523.MoveNext() +5951

标签: c#.netazureconnection

解决方案


经过 4 天的挫折后,我从 azure 中删除了整个项目和 Web 应用程序服务并重新安装它,它工作正常。


推荐阅读