Click here to Skip to main content
15,921,643 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to retrieve the ProductCode? Pin
Heath Stewart28-Jun-04 6:21
protectorHeath Stewart28-Jun-04 6:21 
GeneralRe: how to retrieve the ProductCode? Pin
econnor29-Jun-04 3:53
econnor29-Jun-04 3:53 
GeneralEnumerations (design question) Pin
mealnumberone28-Jun-04 5:44
mealnumberone28-Jun-04 5:44 
GeneralRe: Enumerations (design question) Pin
Heath Stewart28-Jun-04 6:33
protectorHeath Stewart28-Jun-04 6:33 
Questionneed to send within the current connection ..? Pin
Adel83k28-Jun-04 5:18
Adel83k28-Jun-04 5:18 
AnswerRe: need to send within the current connection ..? Pin
Heath Stewart28-Jun-04 6:29
protectorHeath Stewart28-Jun-04 6:29 
GeneralWindows Service App Pin
japanreddy28-Jun-04 4:37
japanreddy28-Jun-04 4:37 
GeneralRe: Windows Service App Pin
Heath Stewart28-Jun-04 4:55
protectorHeath Stewart28-Jun-04 4:55 
What problem? You didn't give a specific problem and we know nothing about your code so how can we diagnose it?

If you want to know what is happening with your service, you need to debug it. Since this problem takes a while to occur, the best way to debug it is to instrument it. The most basic way is to use the Trace facilities in System.Windows.Forms using the EventLogTraceListener. You can configure this progammatically or using the .config file for your Windows Service (which I recommend, since you can change it at runtime).

Throughout your code, use Trace.WriteLine to log state and events in a reasonable way so that when a problem occurs you can determine either what happened or in what part of your code the problem happened.

In your .config file (named the same as your application + .config and in the same directory, like MyServiceApp.exe.config), write something like this:
<configuration>
	<system.diagnostics>
		<trace>
			<listeners>
				<add type="System.Diagnostics.EventLogTraceListener, System"
					initializeData="Application" />
			</listeners>
		</trace>
	</system.diagnostics>
</configuration>
Then whenver you use Trace.Write or Trace.WriteLine (or even the corresponding methods on the Debug class, which is only compiled into your IL if the DEBUG symbol is defined by the compiler) the message will appear in the trace log (use eventvwr.exe to view it).

There are other, more complex (and better) ways of instrumenting your application but this is by far the easiest. It's a good place to start, especially since you gave us no specifics with which we can help you.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Windows Service App Pin
Xiangyang Liu 刘向阳28-Jun-04 5:17
Xiangyang Liu 刘向阳28-Jun-04 5:17 
GeneralFolderBrowserDialog external machine selection Pin
fozzwald28-Jun-04 4:29
fozzwald28-Jun-04 4:29 
GeneralRe: FolderBrowserDialog external machine selection Pin
Heath Stewart28-Jun-04 4:46
protectorHeath Stewart28-Jun-04 4:46 
GeneralProblem with EnvDTE Pin
Johan Van Antenaeken28-Jun-04 4:25
Johan Van Antenaeken28-Jun-04 4:25 
GeneralDynamic Create Class Pin
savaskulah28-Jun-04 4:07
savaskulah28-Jun-04 4:07 
GeneralRe: Dynamic Create Class Pin
Heath Stewart28-Jun-04 4:28
protectorHeath Stewart28-Jun-04 4:28 
GeneralCreation of DLL library Pin
Ronald Boucher28-Jun-04 3:41
sussRonald Boucher28-Jun-04 3:41 
GeneralRe: Creation of DLL library Pin
Serge Lobko-Lobanovsky28-Jun-04 4:19
Serge Lobko-Lobanovsky28-Jun-04 4:19 
GeneralRe: Creation of DLL library Pin
Heath Stewart28-Jun-04 4:22
protectorHeath Stewart28-Jun-04 4:22 
GeneralRe: Creation of DLL library Pin
Ronald Boucher28-Jun-04 6:41
sussRonald Boucher28-Jun-04 6:41 
QuestionDoubleClick a TreeView Node? Pin
j1e1g128-Jun-04 3:08
j1e1g128-Jun-04 3:08 
AnswerRe: DoubleClick a TreeView Node? Pin
Nick Parker28-Jun-04 3:41
protectorNick Parker28-Jun-04 3:41 
AnswerRe: DoubleClick a TreeView Node? Pin
Dave Kreskowiak28-Jun-04 3:43
mveDave Kreskowiak28-Jun-04 3:43 
GeneralRe: DoubleClick a TreeView Node? Pin
j1e1g128-Jun-04 4:05
j1e1g128-Jun-04 4:05 
GeneralRe: DoubleClick a TreeView Node? Pin
Dave Kreskowiak28-Jun-04 4:34
mveDave Kreskowiak28-Jun-04 4:34 
GeneralRe: DoubleClick a TreeView Node? Pin
j1e1g128-Jun-04 4:46
j1e1g128-Jun-04 4:46 
GeneralRe: DoubleClick a TreeView Node? Pin
Heath Stewart28-Jun-04 4:36
protectorHeath Stewart28-Jun-04 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.