sql server user/login所需的最小权限是什么,它能够首先运行实体框架代码数据库迁移?
我天真地以为在Schema和Grant Create Table上具有角色db_datareader,db_datawriter,Grant Alter的用户就足够了.
sql-server entity-framework sql-server-2008 ef-code-first ef-migrations
当EF尝试连接到Azure sql数据库时(可能在尝试打开与数据库的连接时,不确定)它会尝试连接/登录到master数据库,问题是为什么?
连接字符串上的用户不允许连接到master数据库,从我可以看到记录的内容,EF尝试用户未能成功登录master数据库时出现错误,但功能上应用程序正常工作(该应用程序不需要访问master db做任何事情).
从我的研究看来,它似乎与这个问题最相似,但是这已经被关闭,因为不可重复,并且不确定在尝试获取ProviderManifestToken时是否会发生这种情况.
因此,如果数据库用户对数据库具有所需权限,并且连接字符串反映了这一点,那么为什么EF会尝试连接到master数据库?
上下文的示例连接字符串
Server=tcp:MyServer;Database=MyDb;User ID=MyDatabaseUser;Password=*****;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;TrustServerCertificate=False;
Run Code Online (Sandbox Code Playgroud)
记录以下错误消息:
15-05-07 04:06:16.404 System.Data.SqlClient.SqlException (0x80131904): The server principal "MyDatabaseUser" is not able to access the database "master" under the current security context.
Database 'master' on server 'MyServer' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of '69955F47-7746-41560-A03C-807FB9A56478A'.
Login failed for user 'MyDatabaseUser'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean …
Run Code Online (Sandbox Code Playgroud)