Windows COM - how to debug a COM server - com

I have a com server(written in C++, ATL) that runs out of process. In one of my computers I am able to debug the server code easily just by starting the COM under the debugger, setting breakpoints and connection to the server from a client process.
On my another computer this does not happen, if I start the COM server under the debugger from start, the client uses another instance of the same server and the only way to debug the server is to attch to it after the client already started it. How can this be configured ?

The problem was the fact that under the Vista and up when you start the com server elevated (so that the registry part gets in registry at the end of the build) the COM client will launch another COM server instance (at the same integrity level as he was, e.g. medium and not high)
So I had to run Visual Studio for the server as normal user (not run as admin) and had to do the COM registration from command line.

Start your processes normally. Make the debugger stop at a break point in your COM client. Launch another instance of Visual Studio (I am assuming you are running Visual Studio), and attach to the out of proc server process. In Visual Studio 2008, you do it by selecting Attach to process... in the Tools menu. Then simply select the process you want to debug, and there you go. You may want to open the source code files manually to set break points, because you are not debugging within the context of the original project.

Related

Any difference regarding remote COM server activation on Windows 7 vs on Windows XP?

I'm studying Microsoft COM technology from the book Learning DCOM 1999. I am puzzled with its Hello Universe sample program in Appendex D. The code is available here.
This sample contains a HelloClient.exe and a HelloServer.exe. They can be run on different Windows machines and HelloClient.exe is able to remotely call server's exposed IHello interface.
I tried HelloServer.exe on Windows XP and the HelloClient.exe on Win7 successfully call into the remote object.
However, when HelloServer.exe is run on Windows 7, the remote client always fails on CoCreateInstanceEx(CLSID_Hello, ...) with 0x80040154 (Class not registered).
So I think there must be some change since Windows Vista/7 that causes the failure.
Then what is the change, or, what am I missing?
BTW: I compile the code using Visual Studio 2010 SP1.

How to use VB.NET windows service to check if application is running and Close or Kill the application

I have a VB.NET windows service that I created to start another VB.NET application on a virtual machine reboot.
How can I use the VB.NET windows service to check if the application is running and stop or restart the application?
See CheckApp - by me I've coded this Windows service application to check every 5000ms (5 seconds) if a specified process running. You can modify the code with your own relevant processes (e.g. starting that process again if stopped.)
You can install the service using InstallUtil from Tools > Command Line > Developer Command Prompt in order to deploy the service.
Make sure you have logged on as Administrator on Visual Studio.
As soon as the service starts, the timer Refresher starts which does your required work.
Go to Services and find App Checker after installing it, then finally enable it.
Hope it will help you.

"Single instance application": Multiple instances in Windows 2008 terminal server environment

I have a small VB.NET application to handles a custom URL protocol. It is set up in Visual Studio with the option to "Make single instance application". This has worked for hundreds of installations, but a recent customer is using Windows Terminal Server 2008, and it is launching multiple copies of the application. It does not seem to sense that it is already running for a specific user. BTW -
Multiple users can run it without problems in different sessions.
Is there some sort of setting on the Windows Terminal server that could cause this?
We have installed the application using install mode, and with the administrator ID.
Any ideas would be appreciated.

How to debug VB.NET windows service without Visual Studio

I have the source code of an windows service which is written in VB.NET
I came through various methods to debug this service using development environment (Visual Studio). But the challenge is, I need to deploy it in one of our servers as other application on that server need to access it. The server doesn't contain any development or debug tools. I am not allowed to install visual studio in it.
Is there any other way to debug the windows service on this server?
My intention is to understand the method call hierarchy, as this is a very complex code and I didn't write it. It has a very complex architecture and it is not possible to track the data flow only by looking at it.
If the only restriction is you can't install Visual Studio, I'd suggest you get the Remote Tools for VS 2012, which don't even need to be installed to the server, just a machine with a share accessible from the server. Then follow the instructions.

How do I Execute Visual Basic Exe and Crystal report in LAN

Hi I have a Visual Basic Project Exe which runs fine on a Single Machine i Want it to be Execute for Multi User in LAN. I Have Used Crystal Reports in My Project and database is MS Acess. Please Help me how run the Project in LAN..
A VB EXE is a client architecture which usually needs installing on each client machine using it. The code in the EXE could/would normally then connect to external shared, singular resources over a network (such as databases, reporting servers etc.) but the actual EXE itself would typically be duplicated upon each client computer.
If you need all the users to open the exe and have it always run on the same machine, then you could create client shortcuts or use a script with a CreateObject("application.NameHere","serverToRunAppOn") call &/or modify the DCOM settings for the app through the dcomcnfg tool...
However I'd sugguest instead re-evaluating your architecture. Possibly turning your app into a better practice web-based or MS Access shared MDE+MDB solution for clients to connect to.