简体   繁体   中英

How do I debug a .cs codefile while running on a server?

Running the code on my local box is running just fine. As soon as I load the code on my server it is having issues. I can't see the issues because my UI code is calling a webservice via jquery and the webservice is calling into the .cs file that is having an issues. The webservice just returns a failure to the jquery.

Any ideas or help is greatly appreciated.

使用远程调试工具连接到服务器上的W3WP进程。

In short, you will need to add lots of logging in the area of code which is behaving oddly to give you clues as to what is happening on the server.

If the webservice is running on ASP.NET, you can use the built-in logging by enabling trace in your Web.config, and then logging likethis : HttpContext.Current.Trace.Write("hello"); . All of the HTTP queries and your custom logging can then be viewed by going to http://host/Trace.axd

If not on ASP.NET you can either use a library like log4net or roll your own.

Although you could use Yuriy's approach, i wouldn't recommend it since debugging any process as such in production will ensure than none of your other pages will execute during that time since you would have hit the breakpoint.

Add Debug statements inside your Web Service... something like System.Diagnostics.Debug.WriteLine("write more information here");

Run DebugView on the Production server.

http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

Hope this helps, Rahul

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM