Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

debugging

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.

like image 689
SLoret Avatar asked Feb 26 '23 23:02

SLoret


2 Answers

Use the Remote Debugging tools to attach to the W3WP process on the server.

like image 134
Yuriy Faktorovich Avatar answered Mar 13 '23 04:03

Yuriy Faktorovich


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.

like image 42
Yoshi Avatar answered Mar 13 '23 05:03

Yoshi