sisve
sisve

Reputation: 19781

Verify that a method is called via remoting?

How can I, from within a method, verify that it executes inside a remoting context? I've got a basic Client -> NT-Service setup where the service executes as a specific user. This user has access to a SQL Server.

I am looking for a solution that would make it easier to catch problems that occur when the remoting configuration is missing or bad (a method that wasn't specified, etc). I would like to be able to fail with a better error message ("This method requires a remoting context to work properly.") instead of failing with login errors. It's even more tricky when the original user has readonly access to the database and the error isn't thrown until data is written.

Upvotes: 0

Views: 183

Answers (2)

Simon Söderman
Simon Söderman

Reputation: 335

Well, you could use use the stacktrace class in System.Diagnostics to check where the method call is coming from. :)

Upvotes: 1

Nidhi
Nidhi

Reputation: 717

I like using the MS enterprise Library for debugging purposes, you can try using the logging and the exception handling blocks to handle the error.

Upvotes: 0

Related Questions