Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

Windows Service won't instal

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Schoo - 03 Sep 2004 19:00 GMT
I am trying to install a windows service on my XP workstation (XP
Professional) which I do development on.  I am using an example from an
article by Billy Hollis but when I try to run the installutil.exe, it stops
and asks me for a Username and Password (Set Service Login) dialogue box.
This is not mentioned in the article, but then it was written in 2001, so XP
may be more restrictive.  I have tried my login and used my
domainName\UserName, but that didn't work either.  In the end, it will not
install.  Is there anything I am doing wrong or can do differently to
install this Windows Service?

Scott
Phil Wilson - 03 Sep 2004 19:46 GMT
Probably the way you have the Account property set. See the point about
asking for user account at install time:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemserviceprocessserviceprocessinstallerclassaccounttopic.asp

Signature

Phil Wilson [MVP Windows Installer]
----

> I am trying to install a windows service on my XP workstation (XP
> Professional) which I do development on.  I am using an example from an
[quoted text clipped - 7 lines]
>
> Scott
Schoo - 14 Sep 2004 20:53 GMT
I don't understand...  the link you provided seems to point to a way to set
the ServiceAccount property programmatically.  The service is already built
and I am trying to use the DOS window and installutil.exe to get the service
installed.  I don't see what VB program code like the
ServiceProcessInstaller.Account  Property has to do with this.  (maybe it is
just me.  :) )

I am not sure what other accounts are available on the workstation, but
there is a "Guest" account.  I tried my account info and the Guest acct.
with blank password boxes and still it will not let me install.  The actual
error in the DOS window is:

"An exception occurred during the Install phase.
System.CompnentModel.Win32Exception:  The account name is invalisd or does
not exist, or the password is invalid for the account name specified".

Then it initializes a rollback.

I can confirm that my user account is set up as "Computer Administrator"
from the control panel.

I hope someone here has some thoughts because I don't see why this wouldn't
work.

Schoo

> Probably the way you have the Account property set. See the point about
> asking for user account at install time:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemserviceprocessserviceprocessinstallerclassaccounttopic.asp
> --
> Phil Wilson [MVP Windows Installer]
[quoted text clipped - 12 lines]
> >
> > Scott
"Peter Huang" - 15 Sep 2004 08:44 GMT
Hi Scott,

If we need to install the windows service with the installutil tool, we
need to add the Installer class into the project by right click on the
service design view and select Add installer. The serviceProcessInstaller1
will handle the service logon account.
1. Set the Account property to User
2. Set the pass and user
        private void InitializeComponent()
        {
            this.serviceProcessInstaller1 = new
System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
            this.serviceProcessInstaller1.Password = "pass";
            this.serviceProcessInstaller1.Username = @"domain\user";
            this.serviceProcessInstaller1.AfterInstall += new
System.Configuration.Install.InstallEventHandler(this.serviceProcessInstalle
r1_AfterInstall);
            this.serviceInstaller1.ServiceName = "TestAccount";
            this.serviceInstaller1.AfterInstall += new
System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_Afte
rInstall);
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {   
this.serviceProcessInstaller1,  this.serviceInstaller1});
        }

3. rebuild the solution
4. run the installutil tool to install the service which will logon as
{domain\user, pass} pair.

If we do not specified the information the installutil tool do not know how
to do that. You may also look into the link Phil  posted.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Schoo - 16 Sep 2004 16:37 GMT
Ahhh!  I did not know I had to do that.  I see it now and I think we are
getting closer... I have some additional questions though:

There are 2 classes in the BeepService project:  ProjectInstaller.vb and
Service1.vb.  My code is in Service1.vb and there appears to be no code in
ProjectInstaller.vb.  However, if I right click the Service1.vb[design] and
choose "Add Installer", it adds it to the ProjectInstaller.vb[Designer] tab
instead.  I am going to assume this is OK, please let me know if that is
wrong.

Moving along... I then double-click the ServiceInstaller1 object in
ProjectInstaller.vb[Design] and VS.NET auto-creates a
ServiceInstaller1_AfterInstall procedure. I do not see an
InitializeComponet() item in the Procedure drop-down for the
ServiceInstaller1 object.  Am I supposed to just create my own
InitializeComponent procedure?  (BTW:  I am programming in VB.NET so I will
do my best to convert your code).  If so, do I need to set this as a startup
procedure or something?  How will the framework know to run this code first
if it is not in a pre-defined initialize event?

Then, there is the "@"domain\user";" line that you have.  When I get to this
point, I assume this will have to read:  "@ourdomain\myusername" in VB.NET,
right?  Also, do I have to substitute anything for "TestAccount" in your
code example or do I need to set up an account anywhere with that name in
the system or anything?

Also, why do I need to specify the domain when I am just installing this
locally?  If I am being authenticated accross the network to install
something on my workstation, do I need to make sure of any conditions on the
administration server that would do the authentication?

I look forward to reading your response.  :)

Scott

> Hi Scott,
>
[quoted text clipped - 12 lines]
> this.serviceProcessInstaller1.Username = @"domain\user";
> this.serviceProcessInstaller1.AfterInstall += new

System.Configuration.Install.InstallEventHandler(this.serviceProcessInstalle
> r1_AfterInstall);
> this.serviceInstaller1.ServiceName = "TestAccount";
> this.serviceInstaller1.AfterInstall += new

System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_Afte
> rInstall);
> this.Installers.AddRange(new System.Configuration.Install.Installer[] {
[quoted text clipped - 15 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" - 17 Sep 2004 07:35 GMT
Hi

>There are 2 classes in the BeepService project:  ProjectInstaller.vb and
>Service1.vb.  My code is in Service1.vb and there appears to be no code in
>ProjectInstaller.vb.  However, if I right click the Service1.vb[design] and
>choose "Add Installer", it adds it to the ProjectInstaller.vb[Designer] tab
>instead.  I am going to assume this is OK, please let me know if that is
>wrong.

This is OK.

>Moving along... I then double-click the ServiceInstaller1 object in
>ProjectInstaller.vb[Design] and VS.NET auto-creates a
[quoted text clipped - 5 lines]
>procedure or something?  How will the framework know to run this code first
>if it is not in a pre-defined initialize event?

After the steps above, you can change the code view of ProjectInstaller.vb,
and find the #Region " Component Designer generated code ",click the "+" to
expand the region, and you will find the InitializeComponent method.

>Then, there is the "@"domain\user";" line that you have.  When I get to this
>point, I assume this will have to read:  "@ourdomain\myusername" in VB.NET,
>right?  Also, do I have to substitute anything for "TestAccount" in your
>code example or do I need to set up an account anywhere with that name in
>the system or anything?

If you are using an local account you can use the format as below.
"computername\testaccount" so that the install service will know to search
the account in the computername SAM database.

>Also, why do I need to specify the domain when I am just installing this
>locally?  If I am being authenticated accross the network to install
>something on my workstation, do I need to make sure of any conditions on the
>administration server that would do the authentication?

If you are using the AD account(domain account) the Domain controler will
do the authentication, otherwise the local computer do the authentication.

Windows Service Applications
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vboricreatingconfiguringwindowsserviceapplications.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Schoo - 21 Sep 2004 18:47 GMT
I read your description of where to put the code and I found that.  Now I am
trying to add your code to the routine and am having problems with that.
the following are the problems I am having in adding the code:

1)  "me.serviceProcessInstaller1.AfterInstall..." ->  The 'AfterInstall'
item is not in the list of properties/methods for the
serviceProcessInstaller1 item.
2)  "...me.serviceProcessInstaller1_AfterInstall)" ->  The
'serviceProcessInstaller1_AfterInstall' item does not show up on the list of
properties/methods.  Should this be written differently?
3)  "...me.serviceInstaller1_AfterInstall)" ->  Same problem as above in #2.
4)  I am having problems writting the following code you provided as VB.NET.
It seems to be looking for one value and you appear to be giving it two.
How should this be written in VB.NET?

"this.Installers.AddRange(new System.Configuration.Install.Installer[]
{this.serviceProcessInstaller1,  this.serviceInstaller1});"

So, now I know where to put the code, I just can't get the code to go into
the right location.  Please let me know what you think and I will put the
code in.

Thanks,

Schoo

> Hi Scott,
>
[quoted text clipped - 12 lines]
> this.serviceProcessInstaller1.Username = @"domain\user";
> this.serviceProcessInstaller1.AfterInstall += new

System.Configuration.Install.InstallEventHandler(this.serviceProcessInstalle
> r1_AfterInstall);
> this.serviceInstaller1.ServiceName = "TestAccount";
> this.serviceInstaller1.AfterInstall += new

System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_Afte
> rInstall);
> this.Installers.AddRange(new System.Configuration.Install.Installer[] {
[quoted text clipped - 15 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.