Profiling an ASP.Net Web Service Called via AJAX?


MiniProfiler seems to support AJAX requests that are initiated via a button click, but I can’t seem to get the profiler working for a call to an ASP.Net Web Service from JavaScript. Is this supported or is there some workaround to get this working?

Basically I have a web service (MyService.asmx) and inside it, I have a web method (MyWebMethod). First, I do the plumbing to setup the service to be accessible via JavaScript:

<asp:ScriptManagerProxy runat="server" ID="smpMyProxy">
    <asp:ServiceReference Path="~/MyServices/MyService.asmx" />

Then I call the service via JavaScript:

<script type="text/javascript">
  MyProject.MyService.MyWebMethod("someParam", function (results) {alert(results.length.toString());});

That works all fine and dandy, but no profiling info is shown for the web method call. Note that I have plenty of profiler calls throughout the web method, like this:

Using (MiniProfiler.Current.Step("MyService.MyWebMethod"))
  ' Yada yada...
End Using

Maybe I have an old profiler and the new one supports this scenario? Or maybe this scenario isn’t supported at all? Is there some workaround?