Windows Service crashing with event error code 7034 RRS feed

  • General discussion

  • I have deployed a windows service but it is crashing after running for some time. Crash timing is very inconsistent. Sometimes the service runs for 2 days and then crashes, sometimes after 1 day and sometimes after few hours also. I am getting a event error code 7034 in the event viewer that says that service exited unexpectedly.

    I used the Debug Diagnostic Tool to create a rule for service crash and its say the following:
    the assembly instruction at kernel32!RaiseException+53 in C:\WINDOWS\system32\kernel32.dll from Microsoft Corporation has caused a CLR Exception of type (System.IO.IOException) on thread 7. I am creating a full user dump for this. I also tried to use WindDbg tool to analysis this dump by associating source files but nothing useful is cming up in call stack.

    The service creates some threads to shows one notification dialog and then updates during processing and displays them again. Earlier I was getting Sytem.InvalidOperationException due to cross-thread issue. I made code changes and now that issue is not cming. But I am getting this exception now and service is exiting.

    Any help will be appriciated.

    Thursday, October 29, 2009 7:05 AM

All replies

  • I went through the code and found out that I am using System.IO.StreamWriter class to write some info in log files. MSDN suggests that StreamWriter is not thread safe and thus I am using following data to write into log file.

    TextWriter test=new StreamWriter("sample.txt",true);

    but I am still getting System.IO.IOException as per the dump files. If there is anything missing in my code.

    My code is really simple: windows service calls some utility classes to do few sample operations. In each class, notification is being updated and displayed and log is written to log file. Few threads are running that do this work.

    Thursday, October 29, 2009 3:06 PM
  • I have fixed all other issues such as IOException but now my service is not getting exited but in the user dump I am getting System.ComponentModel.InvalidAsynchronousStateException. Any idea what could be the possible reason for it? Anybody got this exception earlier and fixed it?

    Friday, October 30, 2009 2:45 PM
  • Do you still have this problem?
    If yes, can you post your full code? Or at least the part which throws the exception.

    Monday, November 23, 2009 3:48 AM