Debugger.Launch () for a Windows service in Windows 8

After I installed the correct Windows 8 instruction, how it no longer works:

#if DEBUG Debugger.Launch(); #endif 

The service is starting to ignore this thing. Yes, I am creating a project in debug mode.

if I changed this to Debugger.Break() - the service just fails, and there is still no dialogue for attaching a debugger.

+6
windows-8 windows-services
source share
3 answers

Debugger.Launch launches a visual GUI application. By default, services do not interact with the desktop, and therefore everything that they do cannot be "visible."

Support for interacting with the desktop was slowly removed from Windows services (for example, the option "Interaction with the desktop" was removed from some versions of the server). I would suggest that they continue this trend.

Windows services, by their nature, are not GUI applications; they can be launched before and after a user logs on to the desktop and, therefore, cannot constantly display a GUI. Usually you should not depend on the ability to have a graphical interface in the service.

If you want to debug a service, I suggest launching it as a regular application so that you can do things like Run and Debug. Shameless plugin: you can see Developing Windows Services in Visual Studio to create a way that supports this.

+6
source share

The secret is to change the registry key for the Visual Studio JIT debugger with the following:

 reg add "HKCR\AppID\{E62A7A31-6025-408E-87F6-81AEB0DC9347}" /v AppIDFlags /t REG_DWORD /d 8 /f 

Before this change, the value on my machine was 0x28. The above changes it to 0x8. Essentially, it removes the 0x20 flag.

When searching for Microsoft include files (WTypesbase.h) you will find the following:

 #define APPIDREGFLAGS_IUSERVER_ACTIVATE_IN_CLIENT_SESSION_ONLY 0x20 

Once you make this change, the JIT debug window will reappear. I believe all of this is due to various session 0 security changes made by Microsoft.

Source: http://forums.arcgis.com/threads/69842-Debugging-your-SOE-on-Windows-8

+12
source share

Is this a Windows Store app or a desktop app?

Try right-clicking on your project (C # executable project, if you have one) and select "Properties". Then, in the left sidebar of the options, click "Debug". In the "Start action" section, check the box "Do not run, but debug my code when it starts."

Now you can press F5 and start Visual Studio with breakpoints in your code, and it will sit and wait until you start the process. Then run the application (outside of Visual Studio) and Visual Studio will add a debugger.

Do Not Launch option in Properties

0
source share

All Articles