当尝试调试.NET代码调用的TSQL存储的proc时,“断点目前不会被击中…”错误

时间:2021-09-24 02:02:05

I am getting the error:

我得到的错误是:

"The breakpoint will not currently be hit. Unable to bind SQL breakpoint at this time. Object containing the breakpoint not loaded"

“断点目前不会被击中。此时无法绑定SQL断点。对象,包含未加载的断点”

当尝试调试.NET代码调用的TSQL存储的proc时,“断点目前不会被击中…”错误 When I did the steps to debug a stored proc called from my .net app?

当我做了调试从。net应用程序调用的存储proc的步骤时?

What should I be checking?

我应该检查什么?

(VS 2005 and SQL Server 2005 both running on the same PC, I can debug a stored proc if I do "step into" from the Server Explorer)

(VS 2005和SQL Server 2005都运行在同一台PC上,如果我从服务器资源管理器“进入”,我可以调试一个存储的proc)

2 个解决方案

#1


2  

Make sure that in the project properties > Debug > 'Enable SQL server debugging' checked otherwise you won't be able to step into a stored procedure from your .net code (even though you can step through it using server explorer). Has to be the executing project.

确保在项目属性> Debug > 'Enable SQL server Debug '中检查,否则您将无法从.net代码中进入存储过程(即使您可以使用server explorer完成)。必须是执行项目。

If you're calling the stored procedure from a SqlCommand, set a break point on the Command.Execute() line and then step into it. From there you will be taken to the stored procedure code and will be able to walk through it.

如果您正在从SqlCommand调用存储过程,那么在Command.Execute()行上设置断点,然后进入它。从那里,您将被带到存储过程代码,并能够遍历它。

If you continue to get the empty breakpoint icon, try refreshing server explorer.

如果您继续获得空断点图标,请尝试刷新服务器资源管理器。

#2


1  

In addition to enabling SQL Debugging on the project, like DustinDavis said, I had to select "Allow SQL/CLR Debugging" in the context menu for the server in SQL Server Object Explorer (Visual Studio 2015). See How can I step into a SQL Server stored proc from my C# code?

除了像DustinDavis说的那样在项目上启用SQL调试之外,我还必须在SQL server Object Explorer (Visual Studio 2015)的服务器上下文菜单中选择“允许SQL/CLR调试”。看看如何从我的c#代码中进入一个存储proc的SQL服务器?

Also make sure both the user account under which VS runs and under which your application connects have sysadmin privileges.

还要确保VS运行的用户帐户和应用程序连接的用户帐户都具有sysadmin特权。

#1


2  

Make sure that in the project properties > Debug > 'Enable SQL server debugging' checked otherwise you won't be able to step into a stored procedure from your .net code (even though you can step through it using server explorer). Has to be the executing project.

确保在项目属性> Debug > 'Enable SQL server Debug '中检查,否则您将无法从.net代码中进入存储过程(即使您可以使用server explorer完成)。必须是执行项目。

If you're calling the stored procedure from a SqlCommand, set a break point on the Command.Execute() line and then step into it. From there you will be taken to the stored procedure code and will be able to walk through it.

如果您正在从SqlCommand调用存储过程,那么在Command.Execute()行上设置断点,然后进入它。从那里,您将被带到存储过程代码,并能够遍历它。

If you continue to get the empty breakpoint icon, try refreshing server explorer.

如果您继续获得空断点图标,请尝试刷新服务器资源管理器。

#2


1  

In addition to enabling SQL Debugging on the project, like DustinDavis said, I had to select "Allow SQL/CLR Debugging" in the context menu for the server in SQL Server Object Explorer (Visual Studio 2015). See How can I step into a SQL Server stored proc from my C# code?

除了像DustinDavis说的那样在项目上启用SQL调试之外,我还必须在SQL server Object Explorer (Visual Studio 2015)的服务器上下文菜单中选择“允许SQL/CLR调试”。看看如何从我的c#代码中进入一个存储proc的SQL服务器?

Also make sure both the user account under which VS runs and under which your application connects have sysadmin privileges.

还要确保VS运行的用户帐户和应用程序连接的用户帐户都具有sysadmin特权。