Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL CLR Debugging getting "Canceled by user"

When I'm trying to debug a SQL CLR via a SQL Test script in VS2010 (with MSSQL 2008) I get "Canceled by user" in the Debug output window as soon the deployment finish (which is successful.)

I have been up and down the Internet and tried all found solutions and still no go.

System:

Windows Server 2008 R2 Standard SP 1
64 bit Visual Studio 2010
Ultimate SQL Server 2008 R2 (Both running on the same computer)

Steps taken:

  • VS 2010 is run as administrator.
  • SQL Connection User has sysadmin rights on SQL 2008
  • Firewall is set up to allow inbound on the required ports for both VS 2010 and SQL 2008

Been through: http://msdn.microsoft.com/en-us/library/ms165051.aspx

And: http://msdn.microsoft.com/en-us/library/ee828498.aspx

Tried set set Target Framework to 2.0 (from 3.5)

Tried unchecked "Deploy code" in Project Properties under "Deploy" section.

Under Database in Project Properties is set to "Unsafe" and Assembly owner to "dbo".

like image 638
Quintium Avatar asked Dec 09 '11 17:12

Quintium


1 Answers

Some of what's here may repeat what's on the above links - putting everything in one place to make a complete checklist for anyone with this issue.

Add the following ports/protocols to inbound exceptions on both machines (i.e. your desktop & the sql server). Alternatively turn off any firewalls on desktop & server to skip a few of these steps.

  • TCP: 135
  • UDP: 400,500

On your desktop also add devenv.exe to your firewall's process/program exceptions list.

On the server add firewall exceptions for the sqlsrvr.exe and msvsmon.exe processes.

On the server also add a firewall exception for File and Printer Sharing.

Is the VS remote debugging service installed on your server?

Is SQL/CLR debugging enabled on the database / server?

Are you running VS Pro or Team edition?

Does your account have admin rights on the server (OS)?

Does your account have admin rights on the database instance (SQL)?
Here's more info on why sysadmin's required on SQL Server in case there are arguments from DBAs / managers about restricting access further: http://blogs.msdn.com/b/sqlclr/archive/2006/07/07/659332.aspx

Are you connecting using windows authentication?

Have you tried editing sqlserver.config as per: http://www.sqlskills.com/BLOGS/BOBB/post/SQLCLR-debugging-and-VS-2010-revisited.aspx (please note the author's cautions; i.e. this is a hack which can cause issues with the SQL debugger's stability so only do this if you're the only person attaching to this server).

<configuration> 
   ...  
   <startup useLegacyV2RuntimeActivationPolicy="true"> 
       <supportedRuntime version="v2.0.50727" /> 
   </startup> 
</configuration>

If you're on a company network check that there are no proxies which may affect you (if your machine doesn't realise the server is on the same intranet sometimes you'll be going via a proxy). Try using the server's FQDN when connecting as having the full path explicitly stated sometimes helps (at least I've seen this get around issues with ISA Server).

If you have any virus software ensure that exceptions are setup for file extensions .mdf, .ndf, .ldf, .bak, .trn & .$$$.

Are you running the latest service packs for VS, SQL and client & server OSes?

If you still have issues after all that, have you tried running the SQL and VS installers in repair mode, or removing and reinstalling the software?

like image 196
JohnLBevan Avatar answered Nov 12 '22 03:11

JohnLBevan