Windows Service Installation Registry Setting

  • Thread starter Thread starter decrypted
  • Start date Start date
D

decrypted

I want my users to be able to specify where thier configuration files are
located for a windows service. Since having startup params don't seem to be
a real option here I want to use the registery...however...I can't seem to
get that working either. My installation file has the following bit of
code...

Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System");

key = key.OpenSubKey("CurrentControlSet");

key = key.OpenSubKey("Services");

key = key.OpenSubKey(this.serviceInstaller1.ServiceName, true);

key.SetValue("SqlConfig", Environment.CurrentDirectory +
\\SqlConfiguration.xml);

Now if I take out that last line, using installUtil works just
fine....including it and the installUtil rollsback. Any ideas here??

Thanks

-dec
 
What is the error you get with the setvalue call in?

Todd Apley – Visual Basic Deployment Test Team
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| >From: "decrypted" <[email protected]>
| >Subject: Windows Service Installation Registry Setting
| >Date: Fri, 12 Sep 2003 13:52:24 -0700
| >Lines: 26
| >X-Priority: 3
| >X-MSMail-Priority: Normal
| >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| >Message-ID: <#[email protected]>
| >Newsgroups: microsoft.public.dotnet.general
| >NNTP-Posting-Host: bdsl.66.14.114.147.gte.net 66.14.114.147
| >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108339
| >X-Tomcat-NG: microsoft.public.dotnet.general
| >
| >I want my users to be able to specify where thier configuration files are
| >located for a windows service. Since having startup params don't seem to
be
| >a real option here I want to use the registery...however...I can't seem
to
| >get that working either. My installation file has the following bit of
| >code...
| >
| >Microsoft.Win32.RegistryKey key =
| >Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System");
| >
| >key = key.OpenSubKey("CurrentControlSet");
| >
| >key = key.OpenSubKey("Services");
| >
| >key = key.OpenSubKey(this.serviceInstaller1.ServiceName, true);
| >
| >key.SetValue("SqlConfig", Environment.CurrentDirectory +
| >\\SqlConfiguration.xml);
| >
| >Now if I take out that last line, using installUtil works just
| >fine....including it and the installUtil rollsback. Any ideas here??
| >
| >Thanks
| >
| >-dec
| >
| >
| >
 
Back
Top