2

For some weird reason, I can't debug the code inside my static web method. The code itself is like this:

public partial class StoredProcedures : BasePage//Inherits from  System.Web.UI.Page
{
  ...........................
  [WebMethod(EnableSession = true)]
    public static object ProcedureList(int jtStartIndex, int jtPageSize, string jtSorting)
    {
        if (jtStartIndex == null)
            jtStartIndex = 0;
        if (jtPageSize == null)
            jtPageSize = 0;
        if (string.IsNullOrEmpty(jtSorting))
            jtSorting = null;
        //Get data from database
        string sql = "select object_name as Name, status as Status, created as Created from user_objects where object_type = 'PROCEDURE'";
        DataTable ds = RequestSingleton.DBConnection.GetDataTable(sql);
        int procCount = ds.Rows.Count;
        if (procCount != 0)
        {
            DataFiller<StoredProc> dtfStoredProc = new DataFiller<StoredProc>();
            List<StoredProc> list = null;
            list = dtfStoredProc.FromDataTableToList(ds);
      .........................
      .............................. 

The JQuery calls the static method, and if I insert breakpoints inside the static method, they are not used. It's probably something obvious that I'm missing, but seems kinda weird that i can't debug the webmethod. The thing is that I want to see what is going on in there, since something is not right, and without debugging, it's kinda hard. Inserting breakpoints in any other place in the ASP.NET project is not a problem, but in that code block, it is.

2
  • 1
    Are you able to debug a normal page load? Is it only the JQuery webservice calls which aren't workign? Commented Jan 5, 2012 at 16:53
  • Yes, page load and other methods which weren't called by JQuery were debugged as normal, without any issues. Commented Jan 8, 2012 at 7:26

3 Answers 3

4

I have found why the static method couldn't be debugged: the value of trace in the web.config file must be set to true, otherwise the breakpoints are not invoked. So to anyone who might have this problem when debugging static webmethods in ASP.NET, check that trace is set to true. It doesn't matter whether the pageOutput is false or true, but trace has to be set to true. Thanks for your time and answers.

Sign up to request clarification or add additional context in comments.

Comments

0

Make sure that you have the ASP.NET debugger enabled by going to the properties of the web project. Choose the Web tab and in the bottom of that page you have a couple of different options for what debuggers you want to enable.

Also ensure if you have multiple projects that you have attached the debugger, if not you can go to Tools-> Attach to Process and choose the WebDev.WebServer40.exe process and attach to it.

Comments

0

use Debugger.Break in first line, it will pop up message box asking to attach debugger when hit

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.