How to debug a WebMethod in ASP.NET

对着背影说爱祢 提交于 2019-12-06 07:40:35

I do all of my web site debugging in ASP.NET by inserting data into a debug log in my database. This method is very simple and it always works regardless of how your server was called from the client (because a page load, a call to a web service, and a callback from a page all result in different server functionality and return states).

Also, using the Chrome developer tools Network Tab is extremely useful for debugging web methods.

  1. Open a page that is going to make a web request
  2. Open Chrome's developer tools, go to the network tab
  3. Fire the web request. Now you will see a row added to the results in the network tab with the name of the web method and the URL of it. Click on that name and you will see 5 tabs: Headers, Preview, Response, Cookies, and Timing. If your web method threw an error and you have your site setup to display the stack trace on the aspx page, then the 'Response' page will actually show you the rendered error page that was created.

After a long struggle (a whole day), I found what was causing me the issue. The reason why I was not able to debug is because of 2 errors.

I didn't consider to fix because it was a merely a licence error. Now I learnt that only clean (error free code) Web Service can be debugged.

Whereas for debugging via IIS, I used w3wp.exe process attaching to it.

This helped me a lot http://forums.iis.net/t/1154992.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!