Visual Studio Development Bookmark and Share   
 index > Visual Studio Debugger > Having trouble stepping into a stored procedure (get canceled by user)
 

Having trouble stepping into a stored procedure (get canceled by user)

Hi,

I am using VS 2008 and trying to step into a stored procedure on a SQL Server 2005 database. I bring up Server Explorer, double-click on the procedure. It comes up in the text window. I set a break point in it, right click and select "Step into stored procedure". It comes back with "canceled by user". Can you tell me what I am doing wrong ? This is the 1st time I've tried to do this.

Thank you,

Tom Vicker

TomInDenver  Monday, March 17, 2008 3:23 PM

we have been investigating this issue and was able to repro this in one my machine.
OS: Vista SP1
VS2008 targetting SQL server 2005

Turning ON the file sharing did the trick for me, Stepping in to stored procedure worked.
To Turn ON the file sharing in VistaControl Panel ->Network and sharing center
On Sharing and discovery TURN on the File sharing. You need to be administrator to change this setting



Try this step and let us know if it resolves the issue.

Karthik

Karthis - MSFT  Wednesday, July 08, 2009 10:22 PM

Hi Tom,

Could you check for the things below and get back with your findings?

1. Ensure VS is running as an Administrator. The account must be an Admin on the machine running SQL Server 2005.

2. The account used to make the connection to SQL Server must be an Administrator account as well. If you specifiedWindows Authentication when creating the connection and are doing (1) then this is true.

3. Ensure that there are no "dead" connections in Server Explorer i.e. connections to servers that aren't around etc. Easiest is to have only one connection.

4. Verify that executing the stored procedure works fine.

Azeem Khan

VS Debugger.

Azeem Khan - MSFT  Monday, March 17, 2008 6:33 PM
Even I'm facing the same issue..I tried all the above and all r fine...But still getting the same error...

Joseph cherian  Monday, March 17, 2008 6:56 PM

Hi Azeem,

Thanks for response. Here are my responses to your checklist:

1. The user that VS is running under is in the Windows Administrator group on the PC. I also issued the following command on SQL Server (mhf1\tsvicker is the windows id I am using)

sp_addsrvrolemember 'mhf1\tsvicker', 'sysadmin'

2. I connected to SQL Server from VS using the system admin account (sa)

3. There is only 1 connection in Server Explorer, which is the one I am trying to use.

4. The stored procedure works fine.

I also connected with Windows Authentication and I still get "canceled by user". So the failure happens whether I am using Windows or SQL Server authentication.

It does make sense that it might be permissions related, although I wish there were more info in the error message. Is there more I can do check the permissions ? Is there any way I can get more diagnostic info to tell me what's wrong ?

Thanks,

Tom V.

TomInDenver  Tuesday, March 18, 2008 1:47 PM

Tom,

I assume in this case that SQL Server 2005 is running on a remote machine. SQL Server debugging requires that DCOM work between the two machines involved. Could you verify this? One way to check thisis totry andattach to a managed process on the SQL Server machine from the VS machine? This requires DCOM to work. You can launch msvsmon on the SQL Server machine by doing a net use back to the VS machine.

It is not clear if the account mhf1\tsvicker is an Admin on the SQL Server machine. It will have SA role if it is in the local Adminstrators group. Was eithermachine renamed or moved from one domain to another? Anything else that could affect DCOM communication. I assume both machines are on the same domain.

As for the error message, it is definitelynot by design. It isn't something we ran into in our testing unfortunately.

Azeem Khan

VS Debugger.

Azeem Khan - MSFT  Thursday, March 20, 2008 5:40 PM

Hi Azeem,

I did not have Remote Debugging installed on the remote SQL Server machine. I installed it as a service with the tsvicker account which is in the administrators group on both the SQL Server machine and the machine I am trying to debug from (the VS machine). The service started successfully. I tried to step into the stored procedure and it still responded with "canceled by user".

I then executed a "net use isco1dp0858" which is my machine name. This is the response I got:

C:\>net use \\isco1dp0858
The command completed successfully.


C:\>net use
New connections will be remembered.


Status Local Remote Network

-------------------------------------------------------------------------------
Disconnected Z: \\Isco1dp0858\EDrive Microsoft Windows Network
OK \\isco1dp0858\IPC$ Microsoft Windows Network
The command completed successfully.

I am not an administrator and I do not use the "net" command normally. Does this look correct ?

Anyway, I tried to step into the stored procedure again and still got "canceled by user".

Can you provide further help ?

Thanks,

Tom

TomInDenver  Friday, March 21, 2008 5:14 PM

Tom,

Could you trya remote native or managed attach and not TSQL debugging?

Launch notepad on SQL Server machine. Then from VS machine do Debug -> Attach to Process. In the Qualifier specify the remote machine name.notepad.exe which was launched should show up. Select itand do an attach and see if that works.

Also was the VSmachinerenamed or moved from another domain etc. i.e. anything to affect DCOM working. Thanks.

Azeem Khan

VS Debugger.

Azeem Khan - MSFT  Friday, March 21, 2008 6:18 PM

Azeem,

I could not attach to notepad as you suggested until I switched to using VS 2005 (instead of VS 2008). Then it worked. I saw the activity on the Remote Debugging monitor window on the SQL Server machine.I then tried to step into the stored procedure by connecting to SQL Server. This time I did not get "canceled by user". Instead I got I message box with "Unable to attach to T-SQL Debugging. Could not attach to SQL Server process on 'co1msv051-dev'. So with VS 2005 I got further, but it is still not fixed.

When I was struggling with getting to attach to Notepad with VS 2008, I tried configuring Remote Debugging as a service as well as running it manually under mhf1\tsvicker after sharing folder "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x64" (which contains msvsmon.exe). I verified that I could access this folder from the VS machine. In both cases I got error "Unable to connect to the Visual Studio Remote Debugging Monitor named 'co1msv051-dev'. The Microsoft Visual Studio Remote Debugging (MSVSMON.EXE) Monitor Does Not Appear to Be Running on the Remote Computer". I also tried configuring msvsmon to allow connections from any computer vs just from the subnet. Still no change.

So I made progress, but still not there. It is interesting that VS 2008 behaves differently.

BTW, I checked that both machines are in the same domain mhf1. Also, the SQL Server machine is 64-bit and the VS machine is 32-bit. msvsmon is running in 64-bit mode.

Have I proven that DCOM is not the reason it is failing ? Any other ideas ? Thanks for sticking with me on this.

Tom

TomInDenver  Saturday, March 22, 2008 1:52 PM

It sounds like the remote debugging monitor on your SQL server box is VS 2005 remote debugger. Can you try installing the VS 2008 remote debugger?

rchiodo - MSFT  Monday, March 24, 2008 8:37 PM

I tried it using the VS 2008 remote debugger on the SQL Server machine. The behavior is getting even more strange. When I tried to step into the stored procedure (from within VS 2008 on my PC) I got the same message that I mentioned in my very first post (canceled by user).

So then I started notepad on the SQL Server machine and tried to attach to notepad from VS 2008 on my PC. This worked. I was able to attach to notepad.

So then I thought I would try stepping into the stored procedure again. To my surprise, the stored procedure started to execute. The dialog box for the parameter values appeared. I entered values. But instead of it hitting my breakpoint I got message "T-SQL ended without debugging. You may not have sufficient permissions to debug". But even though it didn't hit my breakpoint, the procedure executed successfully.

What is really strange is when I try to step into the stored procedure I get "canceled by user" until I attach and detach to notepad on the SQL Server machine. Then, after that, when I step into the stored procedure it begins to execute, but doesn't allow me to use the debugger.

Once again, my windows userid is in the administrators group on both machines.

Tom

TomInDenver  Wednesday, March 26, 2008 3:16 AM

This is a shot in the dark, but msvsmon (the remote debugger) may be terminating early.

Could you try launching notepad, and attaching with a different debugger instance? This will keep msvmon running on the SQL server machine.

Then while that debugger is attached, try stepping into your SQL stored procedure.

Oh and you have to use the 2008 remote debugger with VS 2008. They are not compatible. And to be safe, I'd uninstall the 2005 remote debugger from the SQL server box. Perhaps it is using the 2005 remote debugger whenever you do SQL debugging.

rchiodo - MSFT  Thursday, March 27, 2008 8:04 PM

We are experiencing the same problem:

Outline:

CLIENT: Windows XP Developer Machine with Visual Studio 2008 Team Suite (VSTS)
Connecting to
SERVER: Windows 2003 Server with SQL Server 2005 and VS2008remote debug tools installed.

From the CLIENTVSTS we can"Attach"the debugger to the SERVER
We have attempted and succeed attaching to the SERVER notepad.exe as previously suggestedin this post.

Selecting the option "Step into Procedure" from Client VSTS we get the error "Canceled by user."

Any help you can lend would be appreciated!

YJBUser  Friday, March 28, 2008 1:09 PM

As you suggested I tried stepping into the stored proc in a 2nd instance of VS (the 1st instance being attached to notepad on remote SQL Server machine). Unfortunately there was no change. I tried this both with VS 2005 and VS 2008 (being consistent with the same VS on both ends).

I can't afford to spend more time on this right now. Hope to resume trying in a few days. I think I will try on a different SQL Server machinenext.I am beginning to think there is some unusual environmental issue with my current configuration, although its clear I am not the only one with this problem. Thanks for your help to this point.

TomInDenver  Saturday, March 29, 2008 1:01 AM

It is also possible that windows firewall might be interfering with the communications between VS and the sql server. In order for sql debugging to work, you need to have an exception turned on for visual studio.

Also, make sure the scope of the exception allows communicating with the sql server. For example, if your sql server is not on you local subnet and the exception rule only applies to your local subnet, sql debugging won't work.

Eric Feiveson - MSFT  Monday, March 31, 2008 8:20 PM

When you say "In order for sql debugging to work, you need to have an exception turned on for visual studio", do you mean any exception or a specific exception ?

Also, I don't understand "make sure the scope of the exception allows communicating with the sql server".

I am not familiar with writing exception rules in VS. I would appreciate more of an explanation or a reference to the doc I need to read to do this correctly.

Thanks,

Tom

TomInDenver  Tuesday, April 01, 2008 7:57 PM

One possibility for why sql debugging isn't working is that Windows firewall could be blocking VS from communicating with the sql server. In order for VS to be able to do sql debugging you either need the firewall to be turned off or you need an exception entry for the firewall that says to not block VS from accepting incoming connections.

By exceptions, I was referring to windows firewall exceptions, not Visual Studio exceptions. You can configure them in control panel->windows firewall (you need to be an admin on your local machine). Look for a check box that says something like "Microsoft Visual Studio".

If the firewall exception is there, check the full path and make sure it refers to Visual Studio 2008, as opposed to Visual Studio 2005. Also, firewall exceptions havea scope associated with them that lists a range of remote ip addresses for which the exception is valid. For example, if the firewall exception has a scope that applies only to the local subnet and the sql server isn't on you local subnet, sql debugging will not work even through the exception is there and turned on.

Also, if you are behind a router and the sql server isn't, it is also possible that your router might be blocking the sql debugging, independent of the settings on your computer. If you are using a router, try plugging your computer directly into your modem, bypassing the router, and see if that works.

Eric Feiveson - MSFT  Tuesday, April 01, 2008 8:07 PM

I checked my firewall. It was off. I also added VS 2008 to the Exception list in Windows Firewall -> Exceptions and checked the box (on themachine running VS). I set the scope to all computers, not just my subnet. The full path to VS 2008 was specified. Still no change. Also, I am not using a router. This is a corporate intranet. Thanks again for your suggestions.

TomInDenver  Wednesday, April 02, 2008 8:28 PM

This thread is running ridiculously long.

I face the same problems, but...

I am totally inexperienced with some of the aspects here, like DCOM.

Here's my setup:
Windows2003 Server running SQL2005

Vista Business Laptop running Microsoft SQl Server Management Studio

SQL Server Business Intelligence Development Studio 2005 - doesn't have the optiuon to step int a procedure. Why??

SQL Server Business Intelligence Development Studio 2008 does have the option, but I get "Canceled by user".

Isn't there a third party tool that can do what this release botched-up? In SQL2000 it was a bit of work to get it running, but it would run.

Cees Cappelle

Rimsky  Wednesday, April 09, 2008 1:29 PM

I have another scenario that cause the "Canceled by user".

The sqlserver service is configured login with a account(not 'LocalSystem'), and this account's password is expired. Then step in to procedure, the VS output "Canceled by user"

just for your infomation.

Lei Shi  Wednesday, April 09, 2008 10:34 PM
Hi Azeem,

u got it working..even i am facing the same issue. could u plz help

Thanks
Joseph
Joseph cherian  Monday, June 02, 2008 8:15 PM
Hi

You must have a Windows Authentication login to the server in order to connect for T-SQL debugging.
It's not enough to use SQL Server Authentication, even if you use "sa" in the Server Explorer connection.
If you try to step into a stored procedure and all you get is "Cancelled by user" in the output window, this may be your problem.

from MSDN

good luck :)
rediz  Wednesday, January 07, 2009 5:42 AM

Hi,

Tell me please, will I get Remote SQL debugging working if I have SQL Server 2008 Express running on SERVER (under LocalSystem) and this server has admin account Godfather and Visual Studio 2008 TS running on ME and my machine has the same user Godfather ?

I mean I have SERVER\Godfather and ME\Godfather. Does having this account named equal gives the ability to connect to remote SQL server with Windows Authentication ?

I'm asking because now I have output 'Canceled by user' after running Debug from VS with successfully opened Data Connection via Sever Browser. Also I'm not able to start debugging from SQL Managment Studio with error 'Unable to start T-SQL Debugging. Could not attach to SQL Server process on 'SERVER'.

  • Proposed As Answer byStanley35 Saturday, May 02, 2009 11:44 PM
  •  
abatishchev  Saturday, January 24, 2009 10:14 PM
local debugging definitely works..
remote requires verification of DCOM setup and remote 2008 debugging service set up.

have not got remote to work yet...
Stanley35  Saturday, May 02, 2009 11:45 PM

we have been investigating this issue and was able to repro this in one my machine.
OS: Vista SP1
VS2008 targetting SQL server 2005

Turning ON the file sharing did the trick for me, Stepping in to stored procedure worked.
To Turn ON the file sharing in VistaControl Panel ->Network and sharing center
On Sharing and discovery TURN on the File sharing. You need to be administrator to change this setting



Try this step and let us know if it resolves the issue.

Karthik

Karthis - MSFT  Wednesday, July 08, 2009 10:22 PM
Hello.
local debugging definitely works
Do you mean local SQL Server?
remote requires verification of DCOM setup
What it is? Could you please describe more. Very interesting! Because I have problem exactly with it.
and remote 2008 debugging service set up.
That's easy. I have it already done.

TIA
abatishchev  Thursday, July 09, 2009 9:17 AM
Karthis,

I am having this issue with VS2008 on my Windows XP workstation targetting SQL server 2005 on Windows Server 2003. Can you try to reproduce it in that environment? Note the machines are not part of a domain and I have the latest service packs for each component.

Thanks,
javacavaj
suttons  Monday, July 27, 2009 1:59 AM
Karthik, hello.

Is your Vista box a member of domain?

Because your trick, unfortunately, doesn't helped my Windows 7 build 7600 (not a member) to start a debugging on Windows Server 2008 x64 Ent SP1 WITH File Sharing turned ON.
abatishchev  Monday, July 27, 2009 4:33 AM
I ran into this problem with Visual Studio 2008 SP1 on Vista SP1 (the client) trying to remotely step into a procedure stored on SQL Server 2008 SP1 (the server).
This would work perfectly on another machine, however.
The SQL Server runs on Window 2008 Server (also a domain controller) under the Administrator account (yes, yes, I know - but for the sake of easy access on my LAN).
MSVCMON runs on that server under a different user account that is part of the Administrators group.
Also, under Local Security Policy on the server, in User Rights Assignment, for 'Log on as a service' I have added that user account (so remote debuggers running under that account can connect to MSVCMON).
The client machines (on which I try to debug) run under that same user account with the same password (but are NOT part of the domain, which does NOT affect any such connections since they all have the SAME password - in other words we can completely ignore the notion of domains and workgroups here, at least in my set up).
The important thing is that the client machines also have their Administrator accounts ENABLED and set to the SAME password as the Administrator account on the server (the account under which SQL Server is running). The same obviously applies to the other user account, i.e. the passwords should be the same on the client and server, but not necessarily the same as the Administrator account (better not to for tighter security).
My problem was that on the problematic client the Administrator account was disabled (though it had the correct password). Even though I was running VS under the user account (that belonged to the Administrators group) I still needed to have the Administrator account enabled and have the same password as that on the server. Not exactly sure why this is necessary, although I suspect it is because SQL Server is running under the Administrator account and VS needs to communicate directly with it. (At the same time this is odd, because I have full log-in rights assigned to the normal user account in SQL Server, and I use this all the time remotely through Windows Authentication mode in SQL Server Management Studio).
To double check, I tried a third machine (Windows XP SP2) whose Administrator account was enabled (but the password was different to the Administrator account on the server). SSMS 2008 (running under the user account belonging to the Administrators group) would report "Unable to start T-SQL debugging. Could not attach to sql server process." After changing the Administrator password to the same one as the server, it worked just fine!
Hope that helps... let me know if more details are required.
Balint  Wednesday, September 02, 2009 3:34 AM

I was able to resolve this issue by setting the "Log on as" account for SQL Server (MSSQLSERVER) to the server's Administrator account. For reference, my complete setup is as follows:

 

1. Client: Windows XP with VS Studio 2008 (9.0.30729.1), Server: Windows Server 2003 with SQL Server 2005 (9.0.4035)

2. Both computers in the same workgroup

3. Administrator account on both machines enabled and set to same password.

4. MSSQLSERVER and MSVCMON (running as a Service) run in the context of the Administrator account.

5. Visual Studio 2008 run in the context of my account (member of Administrators group) on the client machine. The same account was created on the server (member of Administrators group) and the password is the same on both.

 

suttons  Monday, October 12, 2009 3:15 AM

You can use google to search for other answers

Custom Search

More Threads

• Question regarding the server explorer and adding db connections with it.
• Replacement IDE for VS 2008?
• SOS !PrintException does not display StackTrace (and other questions about WinDbg with SOS)
• Remotely Debugging TFS Extensions
• Unable to debug with norton internet security installed
• Debugger - Visualizer (VS2005)
• VS2005 Debugger is ignoring DebuggerNonUserCodeAttribute
• Debug SP in Vs2005
• Too much data
• debugging problem