重新部署时,t-sql c#clr执行权限会丢失。
我已经继承了一个VS2015 .NET C#项目,该项目将C#组件作为CLR存储过程部署到SQL Server 2016。它已经无缝地工作了很多年。
但是最近我注意到,当我重新部署(又称“发布数据库”)时,其中一个汇编似乎丢失了一个用户的执行权限。
有什么方法可以让项目重新申请重新启动后?该脚本必须知道我要部署更新的CLR的SQL Server实例和数据库。谢谢
I have inherited a VS2015 .NET C# project that deploys C# assemblies as CLR stored procedures to SQL Server 2016. It has worked seamlessly for many years.
However recently I've noticed that when I redeploy (a.k.a "Publish Database"), one of the assemblies seems to lose EXECUTE
permissions for one of the users.
Is there a way I can have the project reapply the EXECUTE
permissions after it has redeployed? The script would have to know which SQL Server instance and database I'm deploying the updated CLR to. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从未给予用户对程序集执行权限。我怀疑您意味着执行权限到本程序中引用代码的SQLCLR存储过程中的一个(或更多)。您可以在Visual Studio Project中相当轻松地将其释放后T-SQL脚本添加到Publish Scripts(通过VS的SSDT)中。在此T-SQL脚本中,您只需添加
Grant
语句即可。而且,如果仅在一个特定数据库/实例中有意义,则可以将该授予
语句包装在中,如果 block检查当前实例和/或数据库名称。在VS 2015中添加后发行脚本的步骤:
Grant> Grant
语句(S )该脚本的内容将添加到VS / SSDT生成的任何 exployment < / em> / 发布< / em> / prublish < / em>脚本,因此,您将在执行这些DB中执行这些脚本脚本。
User are never given execute permissions to an assembly. I suspect you are meaning execute permissions to one (or more)of the SQLCLR stored procedures that reference code within this assembly. You can fairly easily add a post-release T-SQL script to your Visual Studio project that will get included in the publish scripts (by SSDT via VS). In this T-SQL script you just add the
GRANT
statement. And, if it only makes sense in one particular database / instance, then you can wrap thatGRANT
statement in anIF
block that checks for the current instance and/or database names.Steps for adding a post-release script in VS 2015:
GRANT
statement(s)The contents of that script will be added to the end of any deployment / publish script generated by VS / SSDT, and hence will execute in every DB in which you execute those scripts.