Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / July 2008

Tip: Looking for answers? Try searching our database.

debugging services

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dwight Johnson - 17 Jul 2008 20:45 GMT
I'm still working thru the sample code. In the ShoppingCart sample,
there is an Invoice message type, but there is no BrokerMethod
associated with it. Complicating this, I cannot figure out how to
debug the service side of things. Any help with these issues would be
greatly appreciated.
Bob Beauchemin - 18 Jul 2008 04:46 GMT
Hi Dwight,

If your service code is written in SQLCLR, the way I debug is through Visual
Studio using "Attach to process". You must attach to the SQL Server process
itself (SQLSERVER.EXE) and if the SQL Server service isn't running as you
(it shouldn't be), you need to check "show processes from all users" to be
able to select it. You should only do this type of debugging on your own
test instance because, as the message box says "using attach to process
could be harmful to SQL Server" (I've had it bring down the SQL Server
process on occasion, due to "pilot error"). You must be running VS as a SQL
Server sysadmin for debugging to work.

Ensure you have the .pdb file for your assembly cataloged (using ALTER
ASSEMBLY ADD FILE ...). Start the debugger, set breakpoints, hit the queue
with a message and the service program should spin up and hit your
breakpoint.

If you're using T-SQL activation proc you can directly debug service
programs, but you can insert PRINT statements into the T-SQL code. The PRINT
statement output will appear in the SQL Server log file. Use SSMS to read
the log.

I haven't got ShoppingCart in front of me, but if there is no BrokerMethod
for the Invoice message type, it's likely being sent by the application not
processed from a BrokerService activator. Search the source for BEGIN DIALOG
CONVERSION (DIALOG keyword is optional) followed by a separate SEND of the
message type.

Hope this helps,
Bob Beauchemin
SQLskills

> I'm still working thru the sample code. In the ShoppingCart sample,
> there is an Invoice message type, but there is no BrokerMethod
> associated with it. Complicating this, I cannot figure out how to
> debug the service side of things. Any help with these issues would be
> greatly appreciated.
Dwight Johnson - 18 Jul 2008 14:48 GMT
Bob,

Thanks again.

I was able to get my process debugged based on your suggestions, as
follows:

1. Add pdb file to Assembly:

ALTER ASSEMBLY
    ShoppingCartAssembly
ADD FILE FROM
    'C:\Documents and Settings\[...]ShoppingCartService\bin\debug
\ShoppingCartService.pdb'

2. Set breakpoint in client if necessary.
3. Start application. [I had to do this first to get the winform to
open.]
4. Set breakpoint(s) in service code.
5. Select Debug > Attach to Process...
6. Check "Show processes from all users". Locate and select
Sqlsevr.exe and hit Attach button.
7. Step thru code. [And it did!]

Dwight
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.