简体   繁体   English

如何调试VB.NET WebMethod?

[英]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. 我有一个使用Web服务的ASP.NET C#项目,并且WebMethods用源代码在VB.NET中编写在本地IIS服务器上。 The WebMethod returns null, and I want to debug it to know why I get this. WebMethod返回null,并且我想调试它以了解为什么得到这个。

As you may know, if I set a breakpoint just before the webmethod call, I cant step into this webmethod. 如您所知,如果我在调用webmethod之前设置了断点,则无法进入该webmethod。

So, how is the correct way to debug this webmethod? 那么,调试此Web方法的正确方法是什么?

Thank you! 谢谢!

Attach the debugger to the server process, put a breakpoint in the web method code and invoke the web method. 将调试器附加到服务器进程,在Web方法代码中放置一个断点,然后调用Web方法。

Visual Studio should break within the web method. Visual Studio应该在web方法内中断。


There is a bug against VS 2005 for this exact bug - see here . VS 2005有一个针对此确切错误的错误-请参见此处

The solution in the KB article is to change the signature of any String parameters of the web method from byref to byval . KB文章中的解决方案是将web方法的任何String参数的签名从byref更改为byval

The web method runs in a different process (the web service) than the consuming application. Web方法在与使用应用程序不同的过程(Web服务)中运行。 Hence, when you debug the consuming application, you cannot step into the web service. 因此,当调试使用的应用程序时,您将无法进入Web服务。 You can, however, debug the web service (eg by attaching to the appropriate IIS process) while running the consuming application. 但是,您可以在运行使用应用程序时调试Web服务(例如,通过附加到适当的IIS进程)。 Another option is to call the web service directly - for simple methods, you can use the test form provided by the web service itself; 另一种选择是直接调用Web服务-对于简单的方法,您可以使用Web服务本身提供的测试表单。 for more complex things, something like SoapUI is useful to trigger web service calls. 对于更复杂的事情,SoapUI之类的东西对于触发Web服务调用很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM