Managing a remote Windows Service - debugging

As part of my app, my users install a Window Service (msi file written in C#) that uploads data to me. These Windows servers are usually behind all kinds of firewalls etc. and run by IT staff so it's difficult to get in touch with anyone to debug.
What can I put inside my application that would make it easier to figure out things? I'm not looking to do anything that would be considered "shady" but here are some ideas I've thought:
Open log files that are relevant to me in a separate thread and stream it back up to the server
Setup some kind of reverse tunnel (not sure if there is a sane shell environment on Windows that I can connect to)
Any ideas or thoughts would be appreciated.

The author of the logging framework we use (the object guy's) has a service that might be useful for you.

You can debug .NET and native code through remote debugger with Visual Studio, see the post of John Robbins about it : http://www.wintellect.com/CS/blogs/jrobbins/archive/2010/06/15/vs-remote-debugging-across-workgroups-or-domains.aspx

Related

Installation with visual studio 2010

I need to create setup file for installation of these:
-Web app
-Win service
-Run some sql scripts.
I wanted to do all in one setup. For example I want to make method like CreateSetup and in that method to create setup file which will contain installation/run of above 3 things.
If you have some links or idea how to do it please share.
Thank you in advance.
If I come across some solution I will post it here for others as well.
It might very well be worth your while to sit down and learn WIX, it seems the preferred method of dealing with more complex setups. I haven't done the tasks outlined here, but I did mange to have an installer that set up an application on a Windows Mobile device.
Looking around a bit, it does seem you can install web applications: http://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application
And a windows service: http://blog.tentaclesoftware.com/archive/2009/01/01/21.aspx
And run SQL scripts: How to run sql script to create database using Wix
It does appear you could even capture what is required to build a SQL string through the windows installer GUI, and use that to know where to run the SQL script, and set up any needed connection strings.

Is it possible to run programs locally from a terminal services remote app?

First, I guess I'd have to figure out if I'm running remotely and second I'd have to figure out whether my remote connection is a standalone remote app or an app running on a terminal server (that may be tricky).
But, once I've figured out all those awful things, is there a way to run a windows function like ShellExecute locally instead of remotely?
The reason I'd want to do this is because I launch a web browser to view rather high bandwidth things that require javascript and flash and certain sysadmins who administer our product aren't too keen on having to make unnecessary and insecure modifications to their terminal server farm.
Yes, if the clients are running Windows and you can install software on them.
See Remote Desktop Services Virtual Channels in MSDN.
There is a free tool that does exactly what you want. I got reference from TechNet forums, it's named Remote Executer from http://www.mqtechnologies.com
Good luck

Need suggestion on replacing Windows Service by invisible WinForm Application

I need a background application to support my client application, which should always run on the client machine regardless of the main client application is running or not.
Windows Service was my first choice but problems I faced with Windows Service were: ease of control over windows service through main client application, release and installation of patches to the windows service and troubleshooting if windows service fails to run.
So, I started thinking for alternatives to the Windows Service and found that a Windows Forms application with NO visible forms can do it for me. This invisible app should start with system startup and keep running all the time, doing all the work that a Windows Service would do. But before I go deeper into the development, I want to explore the pros and cons of this approach.
Any suggestions/comments on this approach?
Your requirements are more suited for windows service. Main advantage with windows service is that it will start as soon as system comes up, irrespective of anybody is logged into system or not.
To sort out deployment issues, you build your business logic into separate assembly and call the necessary function withing windows service. This way you can deploy just the modified assembly.
Winform application with invisible form will not serve the purpose. HTH
That's not possible. User-mode applications must be started by a user, and will not continue to run when that user logs off. That's the purpose of the SessionEnding event: to allow you to shut down your app gracefully when the user logs off or the computer is shutting down. You can't just start something at system startup and keep it running all the time.
You need a Windows Service for that. But you should be aware that under Windows Vista and later, a service cannot interact directly with the user. They run in a separate process and are restricted from displaying their own UI. It's not clear from the question exactly what your needs are, but this is an important limitation of a Windows Service that is worth considering. A proper design really shouldn't require this, but there are apparently a lot of people to whom this new, more secure behavior is a real surprise. I explain this in more detail in related answers to this question and this other question.

Is it possible to easily compile and run code in another machine in Visual Studio/Eclipse?

Let's say I am developing a program that needs a bit more power than a netbook can provide and I have a good computer at home connected to the internet.
Is there any easy way to code in the netbook while I'm not at home and then when building, making it go and run on the computer at home?
I know running programs on other computers isn't a problem, but I'd like to know if it is possible to have an easy experience (it's still possible to debug, etc).
Thanks
It is definitely possible for Java code and Eclipse. But there are issues as well.
It helps a great deal if you have a fixed IP.
You need to open up ports on your firewall to be able to
copy your code into your PC
remote debug and upload your application
The last step will create issues with security that you need to address. I use ssh and public/private key to secure my connections.
In general, what you are asking is not much different to releasing a code to a server and debugging it. And normally servers sit somewhere on the internet or cloud.

Where can I find a good description on how to use COM with Windows Services?

I'm looking to pass parameters into a Windows Service not only upon launch but while it's still running as well. I've heard the best way to do this would be through the COM but I have no idea where to even get started. Are there any good places you can recommend where I can find some helpful information about how to get started with the COM and Windows Services? Thanks in advance!
You can't just get a piece of duct tape and magically "attach COM" to any Windows service. While it is true that you can host a COM object in COM+ and activate it in a Windows service process, but this is not just adding new functionality - it will change the behavior significantly.
In addition to named pipes you can use RPC - start RPC server in the service and make calls to it from the other process.

Resources