kamagra how much to take

Remoting Settings, IPC, And The Registry

This came up today for me, since I use the registry to store the location of my .rem files when setting up my remoting configuration and server. When you are developing complex WebParts sometimes it is better to use the binary formatter over TCP and Interprocess communication (IPC) since remoting kicks ass. I plan on upgrading all my IPC code it to use the new System.Runtime.Remoting.Channels.Ipc namespace, but I haven’t had the time.

Interestingly, I got asked today why I used the regsitry to store my IPC url information instead of something like a .ini or XML config file. To be honest, I never really thought that it was a bad idea to just use the registry (I still love you COM), outside of the fact that other applications may be able to browse that information if they can interrogate registry values. Beyond that, I really liked using the registry previously because it keeps the user configuration indepedent of eachother, config files generally are required per app instance, I sometimes hate tranversing config files (its not hard just too much work :) ), config files lack support for ACL’s, and multi-user threading for requests of values out of the regsitry is supported. Deployment is a concern I guess, and I know with one of the drives for orthodox .NET development is that its use of config files negates the need for setup files through XCOPY and ClickOnce deployment, but honestly building a setup package for submitting registry entries is just really not the hard. I mean honestly in a ProjectInstaller.cs file you can just use the System.Win32.Registry class to represent a node and then the SetValue method in order to place the relevant key/pair in. Then you can just build an internal static string to return something like the IPC url:

  1. internal static string myIpcUrl()
  2. {
  4. string keyPath = "";
  5. try
  6. {
  7. RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ARB\Testing\1", false);
  8. if (regKey == null)
  9. {
  10. throw new CouldNotAccessRegistryException("The IPC URL could not be successfully harvested from the registry. The TCP pipe might need to be manually entered.");
  11. }
  12. keyPath = (string) regKey.GetValue("IpcURL");
  13. regKey.Close();
  14. }
  16. catch (CouldNotAccessRegistryException registryKeyException)
  17. {
  18. throw registryKeyException;
  19. }
  20. catch (Exception accessException)
  21. {
  22. throw new CouldNotAccessRegistryException("The service could not access the registry.", accessException);
  23. }
  24. if (keyPath == "")
  25. {
  26. throw new CouldNotAccessRegistryException("Could not find registry key");
  27. }
  29. return keyPath;
  30. }

I guess some of this will change when I upgrade my code anyways, so maybe I will just bite down and change it. For the time being it works, however unelegant it may be. I still love you registry.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>