問題描述
我們有一個(gè)使用 SQL Server 身份驗(yàn)證的 SQL Server,用戶可以部署,其他用戶可以閱讀,為了簡單起見,我將它們稱為部署"和網(wǎng)絡(luò)".
We have a SQL Server that uses SQL Server Authentication, with users that can deploy, and others that can read, for the sake of simplicity, I'll call them "deploy" and "web".
我在使用 Visual Studio (2012) 數(shù)據(jù)庫項(xiàng)目設(shè)置權(quán)限時(shí)遇到困難,因?yàn)椴渴?用戶沒有足夠的權(quán)限來創(chuàng)建新的服務(wù)器登錄名.
I'm having difficulty setting permissions up using a Visual Studio (2012) Database project, as the "deploy" user does not have sufficient permissions to create new server logins.
我可以添加腳本來執(zhí)行以下操作:
I can add scripts to do things like:
GRANT SELECT ON foo.bar TO [web]
然后這很生氣(SQL71501:權(quán)限有一個(gè)未解析的對象 [web] 引用."),直到我添加:
This then sulks (with "SQL71501: Permission has an unresolved reference to object [web].") until I add:
CREATE USER [web] FOR LOGIN [web];
然后這很生氣(SQL71501:用戶:[web] 有一個(gè)未解析的登錄 [web] 引用."),直到我添加:
This then sulks (with "SQL71501: User: [web] has an unresolved reference to Login [web].") until I add:
CREATE LOGIN [web] WITH PASSWORD = '******';
然后無法發(fā)布:
刪除權(quán)限...
正在刪除權(quán)限...
正在創(chuàng)建 [webuser]...
(67,1):SQL72014:.Net SqlClient 數(shù)據(jù)提供程序:Msg 15247,級別 16,狀態(tài) 1,第 1 行用戶無權(quán)執(zhí)行此操作.
(67,0): SQL72045: 腳本執(zhí)行錯(cuò)誤.執(zhí)行的腳本:
創(chuàng)建登錄 [網(wǎng)絡(luò)用戶]
WITH PASSWORD = '**';
執(zhí)行批處理時(shí)出錯(cuò).
這沒有意義,因?yàn)橛脩粢呀?jīng)存在,所以不需要?jiǎng)?chuàng)建
This doesn't make sense, as the user already exists, so shouldn't need creating
如何允許通過部署用戶發(fā)布,而無需每次都嘗試(重新)創(chuàng)建登錄?或者,是否可以引用外部創(chuàng)建的用戶,而不必發(fā)布它?
How can I allow publishing via the deployment user without trying to (re)create the login each time? Or, is it possible to reference the externally created user, without having to publish it?
推薦答案
由于用戶已經(jīng)存在,我懷疑用于執(zhí)行部署的用戶沒有查看它的權(quán)限.以下應(yīng)該是您解決此問題所需的全部內(nèi)容.
As the user already exists, I suspect that the user that is used to perform the deploy doesn't have rights to view it. The below should be all you need to resolve this.
在 LOGIN::web 上授予查看定義以進(jìn)行部署
這篇關(guān)于發(fā)布 Visual Studio 數(shù)據(jù)庫項(xiàng)目時(shí)可以忽略登錄嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!