sgy
sgy

Reputation: 3052

How-to debug a VB.NET WebMethod?

I have an ASP.NET C# project consuming webservices and WebMethods are wrote in VB.NET with source code on a local IIS server. The WebMethod returns null, and I want to debug it to know why I get this.

As you may know, if I set a breakpoint just before the webmethod call, I cant step into this webmethod.

So, how is the correct way to debug this webmethod?

Thank you!

Upvotes: 0

Views: 3703

Answers (2)

tdammers
tdammers

Reputation: 20721

The web method runs in a different process (the web service) than the consuming application. Hence, when you debug the consuming application, you cannot step into the web service. You can, however, debug the web service (e.g. by attaching to the appropriate IIS process) while running the consuming application. Another option is to call the web service directly - for simple methods, you can use the test form provided by the web service itself; for more complex things, something like SoapUI is useful to trigger web service calls.

Upvotes: 0

Oded
Oded

Reputation: 498972

Attach the debugger to the server process, put a breakpoint in the web method code and invoke the web method.

Visual Studio should break within the web method.


There is a bug against VS 2005 for this exact bug - see here.

The solution in the KB article is to change the signature of any String parameters of the web method from byref to byval.

Upvotes: 1

Related Questions