---
title: "How-to debug a VB.NET WebMethod?"  
description: "How-to debug a VB.NET WebMethod?"  
author: "Anonymous User"  
published: 2014-08-26  
updated: 2023-07-06  
canonical: https://www.mindstick.com/forum/2141/how-to-debug-a-vb-dot-net-webmethod  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# How-to debug a VB.NET WebMethod?

I have an [ASP.NET C#](https://www.mindstick.com/forum/12726/how-to-retrieve-file-version-of-assembly-information-window-in-asp-dot-net-c-sharp) [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) consuming webservices and WebMethods are wrote in [VB.NET](https://www.mindstick.com/forum/426/sqlsever-2000-in-network-with-vb-dot-net-2008) with [source code](https://www.mindstick.com/forum/33476/pls-send-me-source-code-for-changing-passward-in-asp-dot-net-i-tried-so-much-from-google-but-its-not-workining) on a [local](https://www.mindstick.com/forum/546/how-to-create-local-user-in-windows-8) IIS server. The WebMethod [returns null](https://www.mindstick.com/forum/159370/sql-join-returns-null-records-when-there-is-no-data-in-the-database-in-sql-server-why), and I want to [debug](https://www.mindstick.com/forum/156/how-to-debug-application-on-the-server) 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!

## Replies

### Reply by Aryan Kumar

Sure, I can help you with that. Here are the steps on how to debug a VB.NET WebMethod:

1. Create a new [ASP.NET](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) Web Forms project.
2. Add a WebMethod to the project.
3. In the code behind file, add the following code:

VB.Net

```plaintext
Public Function HelloWorld() As String
    Return "Hello, World!"
End Function
```

1. Run the project.
2. In the Visual Studio debugger, set a breakpoint on the line of code that you want to debug.
3. Click the **Start Debugging** button.
4. The debugger will stop at the breakpoint.
5. You can now step through the code line by line and inspect the values of variables.

Here is an explanation of the code:

- The `WebMethod` attribute is used to mark a method as a WebMethod.
- The `HelloWorld` method is a WebMethod that returns the string "Hello, World!".
- The `Set a breakpoint` command is used to set a breakpoint on a line of code.
- The `Start Debugging` button is used to start the debugger.
- The `Step through` command is used to step through the code line by line.
- The `Inspect the values of variables` command is used to inspect the values of variables.

### Reply by Sumit Kesarwani

Hi jay,

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.


---

Original Source: https://www.mindstick.com/forum/2141/how-to-debug-a-vb-dot-net-webmethod

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
