I coded a windows service in Visual Studio 2005, I have the installer with it.
The registry keys for the service are created in System\controls et001\MyService .
The service is installed with LocalService account.
Problem is, after installing it, my service tries to add a key into that registry key location (intentionally added in the code), and it always fails because it does not have permissions, so I have to manually open the registry key and set permissions to LocalService, and start the service again.
Is there any way to set the permissions in the registry key at the installation process of the service?
6 4372 tlhintoq 3,525
Recognized Expert Specialist
The registry keys for the service are created in System\controls et001\MyService .
Which hive are you trying to do this in?
Personlly, I don't thing it should be in ...\System\ ... anything
The hives are organized with a subsection for Software. Generally by company name
HKEY_CURRENT_US ER\SOFTWARE\MyC ompanyName\MyPr ogramName
Is the accepted standard.
It is in HKEY_LOCAL_MACH INE\SYSTEM\...
Thanks for the info. I did not know about the standard.
I did not specify that anywhere, that is where the installer created it.
Where can I specify that?
how about my original question about setting the permissions for the LocalService user when installing? do you have a suggestion?
Thanks.
tlhintoq 3,525
Recognized Expert Specialist
did not specify that anywhere
Problem is, after installing it, my service tries to add a key into that registry key location
I don't understand. Your program is trying to write a registry key, but you aren't specifying where? How can that be?
If you aren't saying where to write it, then how are (do you expect) to read it back?
Sorry I was not clear before.
When I install the service, it creates that path in the registry (with the description, displayname, errorcontrol, and other keys) in the location I told you before.
Of course in my code I'm using that path to create/read a key that I use for other purposes.
My original problem is that everytime I install the service that registry path does not have permissions for LocalService, thus my custom key cannot be created and I get an error. I need to open the registry manually and give the permissions then re-start the service and everything works fine.
Then you told me that the standard is to have the keys in HKEY_CURRENT_US ER\SOFTWARE\MyC ompanyName\MyPr ogram Name,
how can I specify that in the installer so when I install the service it creates all the keys in that path?, I obviously would update my code to write/read my custom key from that location.
I hope it is clear this time.
Thanks.
Plater 7,872
Recognized Expert Expert
I see what you are saying.
I believe the key you are trying to access is the key subset that tells windows the program is a service (and various other settings required to deal with it)
I think you will want your installer to install an additional key set in the standard location that tlhintoq pointed out. Then you should have the permissions for that keyset
Thanks Plater and tlhintoq for your suggestions.
I did what you guys suggested, in my installer project I went to the Registry section (right click on the project -> View -> Registry) and added my key in HKEY_CURRENT_US ER\SOFTWARE\MyC ompanyName\MyPr ogramName.
Obviously I updated my code to read/write the value needed at that key. I seems like it works now without having to set the permission to Local_Service.
I'll be moving my project to QA soon, hopefully it'll work.
Thanks again!.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Arun Bhalla |
last post by:
I'm borrowing some code from Pavel's Command Prompt Explorer Bar installer
to use in my own explorer bar's installer.
Recently I've been thinking that using an assembly version like "1.0.*"
(hence, for example, "1.0.1304.25935") would be useful, at least for
development and debugging purposes. (Someone please point out the cons to
this idea!)
Well, anyway, Pavel's installer basically exists to register the assembly,
and unregister the...
|
by: D Busby |
last post by:
List
I've made a .NET windows service in C++, then I added an installer to the solution. I added the 'Project Output' from my .NET service as a package for the installer to install however it does not install my program as a service on the client machine. Is there something special I need to do? Shouldn't the 'Project Output' show the installer that I have made a service and then install the thing properly?
|
by: Dermot O'Loughlin |
last post by:
I am trying to install a dotnet application using it's websetup msi
dotnet application. I am getting the following error:
The Windows Installer Service could not be accessed.
This can occur if you are running windows in safe
mode, or of the Windows installer is not currently
installed......
We are running Windows 2000 server SP4.
|
by: sidd |
last post by:
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..
1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe
OR
is it must to have an installer to the service project to be able to
|
by: Arun Bhalla |
last post by:
I'm working with VS.NET 2003 and .NET 1.1 (not SP1) on Windows XP SP1. My
application is using the Windows Installer Bootstrap. (I may have also
installed a module which detects requirements (.NET 1.1 -> MsiNetAssembly
Support.) I have a few issues and questions regarding the MSI and its
properties.
* This may be my biggest annoyance at the moment. When the installer creates
the target directory, it's setting them as read-only. When the...
| |
by: Arun Bhalla |
last post by:
I'm having some inconsistency problems with my deployment project ("Setup")
and its custom actions ("Installer"). I'm using Visual Studio .NET 2003
(.NET 1.1, no service pack) on Windows XPSP1.
My main project is a band object (Explorer Bar) in an assembly (.DLL) that
needs to be registered on installation and unregisted on uninstallation. In
addition, during installation, Setup creates registry subkeys, sets registry
values, installs...
|
by: ARC |
last post by:
I'm currently looking at the access developer extensions for creating an MSI
installer package for a 2007 runtime app. Couple of observations and
questions.
1) Doesn't look like we have the ability to set a packaged file to always
overwrite, or never overwrite, unless I'm missing something. This could be a
sticking point, as I would always want the program to overwrite on
re-installing, but NEVER the back end database. I have a few more...
|
by: Pep |
last post by:
Firstly, I'm not sure if this is the right group for this query, so
please forgive me if I am wrong.
My problem is that most users I distribute my software to cannot
install it on their systems due to not having the correct
administrator rights. I'm perplexed over this as I cannot reasonably
ask corporations to allow the local secretary to have admin or power
user rights just to install my software.
My software is intended for user...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |