Wednesday, July 29, 2009

Remoting!

Here is an issue I ran into:

I developed a service that monitors a few databases, and database servers and performs actions on them if required. I could have hard coded the configuration: which servers to monitor and what actions to perform and when, but then I wouldn't have been able to easily share it with everyone else out there running into similar issues, including people within my own company.

So I set up a configuration file to handle that. The problem with configuration files is that if you screw them up, your program won't know what to do with them, plus XML can be a pain if you don't know what elements and attributes to use. To combat this I made a forms application that provides a simple, intuitive way for people to modify the configuration file. So far so good.

I wanted to make the UI a bit more useful and have it display what the server was doing at the moment because some of the tasks could take a while; I also didn't want to force the people running the configuration interface to have to have elevated SQL privileges. This is where I ran into problems. The forms app can't access directly the instances of the service that are running because they're in different application domains. The way around this I found to be Remoting.

I got most of my help from this page here:

http://www.codeproject.com/KB/IP/remotingchatsample.aspx

There are a lot of examples out there that make use of configuration files and generally try to over complicate things for the beginner, this blog was especially sharp and to the point.

Let me know if you have any questions.

No comments:

Post a Comment