I have
#if debug then
#end if
statements inside a webservice which outputs event viewer logs. This works ok when testing locally. If I build a debug version and then copy the files across to the live server and re-cycle the app pool of the webservice, I don’t see these logs in the event viewer. Is there any reason why this isn’t working?
The
<compilation debug="true" />does not define the DEBUG preprocessor flag. You would need to modify the system.codedom configuration to do that. The default Visual Studio template comes with predefined flags (Project Settings > Build, “Define DEBUG constant” and “Define TRACE constant”) which is why they work in project you compile within Visual Studio.Use HttpContext.IsDebuggingEnabled instead.