我正在尝试将Azure中托管的应用程序连接到Azure中托管的数据库。我收到错误请找下面的
“502 - Web服务器在充当a时收到无效响应 网关或代理服务器。“
当应用尝试查询数据库时。
在Azure中托管应用程序和数据库之前(应用程序在localhost上运行),我的内部SQL服务器数据库的连接字符串如下所示:
Data Source=DESKTOP-LCO4GKN;AttachDbFilename=|DataDirectory|BakaAppDb.mdf;Initial Catalog=BakaAppDb;Integrated Security=True
将数据库迁移到Azure并使用登录创建用户后,我输入了连接字符串,如下所示:
Server=tcp:betterorgappserver.database.windows.net;Database=BetterOrgAppDatabase_Dogfood;User ID=login1user;Password=*******;
问题是连接字符串应该如何?我在我的应用程序中使用实体框架,如果这可能会影响它的外观。
修改
过了一段时间,我“管理”得到错误,指出用户登录失败
用户'login1user1'登录失败。
这是堆栈跟踪:
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +347
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217
System.Data.SqlClient.SqlConnection.Open() +96
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c) +10
and so on...
我想这意味着我错误地向用户授予了权限。那么现在的问题是如何添加具有访问数据库权限的新用户?
由于