[英]Can't attach to SQL Server to debug SQLCLR Stored Procedure
I want to debug a SQLCLR stored procedure in SQL Server. 我想在SQL Server中调试SQLCLR存储过程。 I have been trying to debug an SP in VS2015 Community and in the recently installed VS2017 Community editions without success.
我一直在尝试在VS2015社区和最近安装的VS2017社区版本中调试SP,但没有成功。 I am pretty sure that the problem lies in attaching to SQL Server but as I've done everything I can find mentioned online but to no avail.
我很确定问题在于附加到SQL Server,但因为我已经完成了我在网上提到的所有内容,但无济于事。
When creating the database project in SQL Server Express LocalDB everything works fine. 在SQL Server Express LocalDB中创建数据库项目时,一切正常。 If I change the connection string to use my Developer Edition SQL Server, I then get an error.
如果我更改连接字符串以使用我的Developer Edition SQL Server,那么我会收到错误。 I have done the following:
我做了以下事情:
In Visual Studio I created a simple database project with a simple method to send some text to the output pipe. 在Visual Studio中,我使用一种简单的方法创建了一个简单的数据库项目,以便将一些文本发送到输出管道。
[Microsoft.SqlServer.Server.SqlProcedure] public static void mytest () { SqlContext.Pipe.Send("in clr Craig1"); }
Thereafter, the procedure executes and performs the pipe function, but it does not let me do the attachment and the debugging. 此后,该过程执行并执行管道功能,但它不允许我进行附件和调试。
Any ideas of what I'm doing wrong? 我做错了什么想法? Thanks Craig
谢谢克雷格
You might just need to start Visual Studio with "Run as Administrator". 您可能只需要使用“以管理员身份运行”启动Visual Studio。 I do not believe that I needed to do that when running Windows 8, but I am running Windows 10 now and definitely need to "Run as Administrator".
我不相信在运行Windows 8时我需要这样做,但我现在正在运行Windows 10并且肯定需要“以管理员身份运行”。 I am guessing that you cannot otherwise attach to someone else's process (I have my Developer Edition running with a service account of "SQL Server", yet LocalDB always runs as the Login that started it, typically yourself).
我猜你不能以其他方式附加到别人的进程(我的Developer Edition使用“SQL Server”服务帐户运行,但是LocalDB总是作为启动它的登录运行,通常是你自己)。 I have not tested to see if running Developer Edition as myself would still require "Run as Administrator", or how running Developer Edition as "Local System" would affect this behavior.
我没有测试过看看运行Developer Edition是否仍然需要“以管理员身份运行”,或者如何将Developer Edition作为“本地系统”运行会影响此行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.