.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Debugging a Windows Service (VS 2008 / .NET 3.5) Using Debugger.Launch()

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :WCF
Hi, Everybody! I wrote a Windows Service using VS 2008 (.NET 3.5).  I wish to debug it.  I am able to build it and install it successfully.  When I start the service, the Visual Studio Just-In-Time Debugger (VS JIT Debugger) appears displaying the following message: An unhandled exception ("Launch for user") occurred in <WindowsService> [3392] (or [2560] or [5180] or ...).  I select the following Possible Debuggers <WindowsService> - Microsoft Visual Studio: Visual Studio 2008 and click the Yes button.  This is followed immediately by the following dialog box: Caption: Microsoft Visual Studio, Message: There is no source code available for the current location.  Clicking the Show Disassembly button results in displaying the disassembly.  The call stack shows mscorlib.dll!System.Diagnostics.Debugger.Launch() + 0x6a bytes.  The exception apparently occurs in Debugger.Launch();.  If I choose to continue, I am able to debug the Windows Service, stopping at the specified break points.  Why does the VS JIT Debugger appear in the first place?  How can I use Debugger.Launch(); without the VS JIT Debugger appearing?  See code below... protected override void OnStart(string[] args) { try { Debugger.Launch(); var t = new Thread(Start); t.IsBackground = true

View Complete Post

More Related Resource Links

Windows service can't use Reporting Services on SQL Service 2008 R2

Hello. I have a Windows service that run as Local System account. The service uses the Reporting Services ReportService2005.asmx web service. When I have SQL Server 2008 installed, I have no problems and my service is able to browse and create report. After I have installed SQL Server 2008 R2 I get the error "The request failed with HTTP status 401: Unauthorized." when the service tries to use the web service. If I change my service to log on as a user with administrator rights, it is able to use Reposting Services again. What has changes in SQL Server 2008 R2, that doesn't allow the Local System account to use Repoting Services? And is it possible to configure Reporting Services to allow it?   - Per

Re; Debugging windows service

I was trying to debug into this windows service which runs as a worker process in the background and picks up a function and tries to perform a task every few seconds, I installed the service locally on my system and attached the service to the debug process, I set all the breakpoints in the service code so I assumed that the debugging stops at these breakpoints but they never seem to pick up, do you think I am missing something?  Any help is grealty apreciated.Thanks

Problem consuming 32bit WCF service which references a native Dll in a 64 bit OS(Windows Server 2008

I have some 32bit Dlls which i want to use it in 64bit OS as i do not have a source code of this to recompile it for 64 bit OS. I have created a x86(32 Bit) WCF service which calls these Dlls and hosted it as a Windows Service on a x64(64 Bit) machine using Windows Server 2008. I have created one more x64 client which calls a function in the WCF which in turn calls a function from the 32 bit native Dll. Whenever i try calling this WCF from the client I get an error as given below.Can anybody please guide as to where I am going wrong and what is needed to solve this issue. Thanks in advance for any help.******The Error Message********************System.BadImageFormatException: Could not load file or assembly 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.File name: 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null'   at TestWrapperWCFClient.Form2.button1_Click(Object sender, EventArgs e)   at System.Windows.Forms.Control.OnClick(EventArgs e)   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)   at System.Windows.Forms.Control.WndProc(Message& m)   at System.Windows.Forms

Launch window forms app from windows service

I have a windows forms app that is used to manage settings for a windows service. When the service starts I want to launch the forms app. I'm using Process.Start("myWindowsApp") and I can see the app running in the task manager processes but the windows aren't displayed. My guess is that it's because the service is running under the localsystem account but what do I need to do to make the windows forms app work properly? SteveR

Help deploying Windows Service to 64bit Server usinf Visual Studio 2008 Setup Project?

I have a Windows Service I created a while back for our Win2003/2008 32bit Servers, written in Visual Studio 2008, deployed via a VS2k8 Setup Project.  Everything works great, installs fine, and runs as it should.  There is no platform dependent code, it's all straight-up .Net Framework stuff, so we thought it should deploy to a Win2008 64bit Server just fine.  But this seems not to be the case.

When I try to install the Service as is on the 64bit machine, the service and associated DLL's are installed to the "C:\Windows\SysWOW64" folder, but when you right click the Service itself and look at the properties, it is trying to find the .exe file in the "C:\Windows\System32" folder. This difference prevents the service from running, obviously.

If I change the Setup Project settings, set the Target Platform to "x64" and change in the File System screen to use the "System (64-bit) Folder" placing the files in there and re-run the setup.exe on the server.... now the files are correctly installed to the "C:\Windows\System32" folder, but the Service itself is not 'installed', that is it *does not* show up in the Services Manager.

Just for the giggles of it I tried to manually install the service using 'installutil.exe' in the .Net Fra

Messenger service is not in Windows 2008 but Sql Server 2008 is asking for it to run Database Mail


so how do you make Database Mail work in SQL Server 2008 without messenger service

Pat M


PatM Reno

Word Automation through Windows service (Windows Server 2008) - Problem

I went through the thread in this link http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/65a355ce-49c1-47f1-8c12-d9cf5f23c53e (which is a very similar problem to mine), but couldnt solve my problem.
I seem to face a very related problem in word automation.
I have created a windows service which creates a sample word document (WORD 2007) and then converts it to a .doc file (WORD 2003 format) or a PDF file , based on requirement.  Let me post the sample code here :

Web Service 2.0 migrated to Windows server 2008

I developed a web service using 2.0 and it was working fine and We recently moved it to Windows server 2008.
I could see that all the System records are being created as expected but not the log file and result files.
We write these files in a shared folder in a different server(also, we prefer this to happen across domain too.). 
I made sure we use specific application pool and set it to use Integrated mode.
What could be wrong ?

Cant move system databases of SQL Server 2008 (Clustered) running in Windows 2008 with Service SID e



I was trying to move system databases of SQL Server 2008 on clustered emvironment running on Windows 2008.

I remember while doing the cluster installation somewhere it gave me a recomended option of using Service SID. I think that is the culprit here. Because if you see the "Security" of the DATA folder containing all the MDF and LDF (by default location) you will find a Group named "MSSQLSERVER" is having full access to that directory.

While moving the system databases you need that account (MSSQLSERVER) given access to the parent directory containing the MDF and the LDFs, But unfortunately you cannot add that account manually. Even I tried XCOPY to make sure that while copying the ACLs gets transferred properly to the destination, even that failed.

I think it does provide a solid Security but at the expense of Maintenance, which I cant agree.

Also I forgot to tell you that this Sevice SID option is available if you are using Windows Vista / Windows 2008 or above,

Does anyone has any experience of moving the system databases with Service SID enabled in a cluster environment.

As a testing just try to copy/xcopy/robocopy any folder having MSSQLSERVER group in the ACL and see what happens .. If you are lucky like me then you will get ACCESS DENIED error.

Have anyone faced the same error? I h

SQL 2005/2008 on Windows Server 2008 R2 cluster - Service only starts when account is local admin


I have a single node Windows Server 2008 R2 cluster configured with SQL Server 2008 Enterprise Edition installed as a clustered instance.

I am having an issue where the SQL Server service will only start using TCP/IP when the service account is a member of the local admins group. To get SQL to install I had to add the sql server service account to the local admins group.

I have configured group policy with the permissions required for SQL Server 2008 and this is correctly applied to the node.

Errorlog shows the following...

Error: 26054, Severity: 16, State: 1.
2010-05-05 15:23:41.98 Server      Could not find any IP address that this SQL Server instance depends upon.  Make sure that the cluster service is running, that the dependency relationship between SQL Server and Network Name resources is correct, and that the IP addresses on which this SQL Server instance depends are available.  Error code: 0x5.

2010-05-05 15:23:41.98 Server      Error: 17182, Severity: 16, State: 1.
2010-05-05 15:23:41.98 Server      TDSSNIClient initialization failed with error 0x5, status code 0xa. Reason: Unable to initialize the TCP/IP listener. Access is denied.

2010-05-05 15:23:41.98 Server      Error: 17182, Severity: 16

Debugger Engine API: Writing a Debugging Tools for Windows Extension, Part 2: Output


Continuing to work on his Debugger Engine extension, Andrew Richards shows you how to avoid all the dangerous traps you might find as you enhance the tool's output.

Andrew Richards

MSDN Magazine May 2011

C# Windows Service Visual Studio 2008

Here I will demo you how to create a windows service project using C# and using .NET Framework 3.5, to cover the latest of technologies. Older framework are not much different in developing, you can find how to develop older framework Windows service from Google. I'm going to teach you how to develop a windows service

Creating your skeleton project in Visual Studio 2008

To create a Windows Service project in Visual Studio 2008, you must select from the Visual C# Windows Projects. Give your Windows Service a name, and then select OK.

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

Word Automation Issue in Windows Server 2008 Hosting



The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.

With Regards,


No ASPNET User in Windows Server 2008?


I have been looking everywhere online regarding this, but have not found a clear answer.


I have an ASP.Net app running on Windows Server 2008, it's basically a reporting app using Crystal Reports. I have encountered a roadblock in regards to rendering some pages. When I run the app in Visual Studio(on the same 2008 machine) everything works perfectly. Yet when I publish it and run it live the reports will not display correctly, I get a message saying Failed to render page.


I looked this error up in the Crystal Reports website and the fixes they have there refer to giving the windows "aspnet" user full access rights to certain folders on the machine. I would be happy to do this, however there is no aspnet user in Windows Server 2008.


I installed the server and set its role to be Web Server. I also checked all the options regarding ASP.Net and IIS 6 compatibility. Yet there is no ASPNET username anywhere.


Did I set the server up wrong? or do I have to do something within ASP.Net to  create this user and then give it rights? 

Not working on Windows Server 2008




I had the CSS friendly adapters working great on our old server (windows server 2003 - 32bit) and now we have moved to a 64 bit environment and now I can not get the CSS friendly adapters to work.

We are using SharePoint 2007.

Is there another work thru for 64bit environment.

I notice windows server 2008 has a directory  C:\Windows\Microsoft.NET\Framework64 would I be using the browser file in this directory???

Please help!

Windows With C++: X64 Debugging With Pseudo Variables And Format Specifiers


This month we explain how pseudo variables and format specifiers provide a wealth of information for use in debugging.

Kenny Kerr

MSDN Magazine December 2008

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend