I am looking for a way to debug what happens between $.ajax and Controller action. Is there a way to see how long these stretches are and if there is a delay where it happens(if network, then where?)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s one approach you could try in order to isolate the problem. You start a brand new ASP.NET MVC application and put a controller action that simulates some work:
and you invoke it with AJAX:
then observe the time it takes for the AJAX request to execute in your javascript debugging tool (I am using Chrome developer toolbar but you could FireBug as well if you prefer):
405ms. Great, I guess this figure doesn’t surprise anyone. If you get a different number you may start worrying seriously. But I doubt you will get a different number. So the problem doesn’t come neither from ASP.NET MVC nor AJAX.
That’s barebone. Now you could start adding some real work to your controller action by shaping it with database calls and stuff until you find the smoking gun. Add things progressively. Start by manually instantiating your repository class, then if you are using DI framework add that later, etc… It’s very important to do it one step at a time.