简体   繁体   English

从Visual Studio调试SQL Server 2005中的存储过程?

[英]Debugging stored procedure in SQL Server 2005 from Visual Studio?

I see a lot of frustrated questions here and elsewhere with no clear answer. 我在这里和其他地方看到了许多令人沮丧的问题,没有明确的答案。 I am trying to get the stored procs to debug, but with no success. 我试图让存储过程调试,但没有成功。

Client: either VS2005 or VS2008, works in neither. 客户端:VS2005或VS2008,两者都不兼容。 When I select 'Step into Stored Procedure' from the sproc context menu, I get "Cancelled by User' in the debug window and that's the end of it. 当我从sproc上下文菜单中选择“Step into Stored Procedure”时,我在调试窗口中得到“User by User”,这就是它的结束。

I did the following to help myself (all to no avail): 我做了以下事情来帮助自己(一切都无济于事):

  1. Right clicked on the connection and selected 'Application Debugging' and 'Allow SQL/CRL debugging' 右键单击连接并选择“应用程序调试”和“允许SQL / CRL调试”
  2. Made sure that all the boxes are on the same domain. 确保所有框都在同一个域中。
  3. Made sure that I am logging in to SQL Server with the same domain account that I log into my workstation with. 确保我使用与我登录到工作站的域帐户登录到SQL Server。
  4. Made sure that my domain account is both an admin on the SQL box and an admin within SQL Server. 确保我的域帐户既是SQL框的管理员又是SQL Server的管理员。
  5. I ran msvsmon.exe on the SQL box and successfully attached to a process from my client box (in VS). 我在SQL框上运行了msvsmon.exe,并从我的客户端框(在VS中)成功附加到进程。

What am I missing? 我错过了什么?

One important issue here is that this won't work if SQL Server process is running as local system, which is the default install. 这里的一个重要问题是,如果SQL Server进程作为本地系统运行,这将是无效的,这是默认安装。 It needs to be running as an account which is in the administrator group on the local machine. 它需要作为本地计算机上的管理员组中的帐户运行。

What I have done is set up local user on my box named "sqlserver" and put it into the local administrators group. 我所做的是在名为“sqlserver”的盒子上设置本地用户并将其放入本地管理员组。 Then, go into the service control panel, stop the sql server service. 然后,进入服务控制面板,停止sql server服务。 Modify it and set it to run as the specified user account rather than as local system. 修改它并将其设置为以指定的用户帐户而不是本地系统运行。 Specify the sqlserver local user account and the password you created. 指定sqlserver本地用户帐户和您创建的密码。 Then restart the service. 然后重启服务。

What edition is your SQL Server? 你的SQL Server是什么版本的? SP debugging is only available in Pro and Team edition (not Express and Standard) SP调试仅适用于Pro和Team版本(不是Express和Standard)

Also make sure (again) you're using Windows authentication to login and your account is a sysadmin in SQL server. 还要确保(再次)使用Windows身份验证登录,并且您的帐户是SQL Server中的sysadmin。

As you are able to attach to a process on the SQL box, I assume DCOM to work correctly and there is no blocking firewall in between. 由于您可以附加到SQL框上的进程,因此我假设DCOM正常工作,并且两者之间没有阻塞防火墙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM