Hi,
I have a Installer class used to install my windows service, it was created
by the
wizard that is in the VS, I just whent into the properties and set up the
properties of the ServiceInstalle r member by using the properties windows.
But I choose the DinamicProperti es, the wizard created into the
"InitializeComp onents" two assignations of the ServiceInstalle r properties
by instanciating the System.Configur ation.AppSettin gsReader this properties
are in the app.config file.
ie.
private void InitializeCompo nent()
{
System.Configur ation.AppSettin gsReader configurationAp pSettings = new
System.Configur ation.AppSettin gsReader();
this.m_MonitorP rocInstaller = new
System.ServiceP rocess.ServiceP rocessInstaller ();
this.m_MonitorI nstaller = new System.ServiceP rocess.ServiceI nstaller();
//
// m_MonitorProcIn staller
//
this.m_MonitorI nstaller.StartT ype = ServiceStartMod e.Manual;
this.m_MonitorP rocInstaller.Ac count = ServiceAccount. LocalSystem;
//
// m_MonitorInstal ler
//
this.m_MonitorI nstaller.Displa yName =
((string)(confi gurationAppSett ings.GetValue(" key_DisplayName ",
typeof(string)) ));
this.m_MonitorI nstaller.Servic eName =
((string)(confi gurationAppSett ings.GetValue(" Key_ServiceName ",
typeof(string)) ));
}
But at the time run the installutil in order to install the service I got
some errors:
An exception occurred during the Install phase.
System.InvalidO perationExcepti on: Unable to create an instance of the
MonitorService. Installer.Monit orInstaller installer type.
The inner exception System.Reflecti on.TargetInvoca tionException was thrown
with
the following error message: Exception has been thrown by the target of an
invoc
ation..
The inner exception System.InvalidO perationExcepti on was thrown with the
followi
ng error message: The key 'key_DisplayNam e' does not exist in the
appSettings co
nfiguration section..
I when into the .config file after I compiled the solution and the key is
there.
Could any of you advice why I cannot read the .config file.
Cheers...
I have a Installer class used to install my windows service, it was created
by the
wizard that is in the VS, I just whent into the properties and set up the
properties of the ServiceInstalle r member by using the properties windows.
But I choose the DinamicProperti es, the wizard created into the
"InitializeComp onents" two assignations of the ServiceInstalle r properties
by instanciating the System.Configur ation.AppSettin gsReader this properties
are in the app.config file.
ie.
private void InitializeCompo nent()
{
System.Configur ation.AppSettin gsReader configurationAp pSettings = new
System.Configur ation.AppSettin gsReader();
this.m_MonitorP rocInstaller = new
System.ServiceP rocess.ServiceP rocessInstaller ();
this.m_MonitorI nstaller = new System.ServiceP rocess.ServiceI nstaller();
//
// m_MonitorProcIn staller
//
this.m_MonitorI nstaller.StartT ype = ServiceStartMod e.Manual;
this.m_MonitorP rocInstaller.Ac count = ServiceAccount. LocalSystem;
//
// m_MonitorInstal ler
//
this.m_MonitorI nstaller.Displa yName =
((string)(confi gurationAppSett ings.GetValue(" key_DisplayName ",
typeof(string)) ));
this.m_MonitorI nstaller.Servic eName =
((string)(confi gurationAppSett ings.GetValue(" Key_ServiceName ",
typeof(string)) ));
}
But at the time run the installutil in order to install the service I got
some errors:
An exception occurred during the Install phase.
System.InvalidO perationExcepti on: Unable to create an instance of the
MonitorService. Installer.Monit orInstaller installer type.
The inner exception System.Reflecti on.TargetInvoca tionException was thrown
with
the following error message: Exception has been thrown by the target of an
invoc
ation..
The inner exception System.InvalidO perationExcepti on was thrown with the
followi
ng error message: The key 'key_DisplayNam e' does not exist in the
appSettings co
nfiguration section..
I when into the .config file after I compiled the solution and the key is
there.
Could any of you advice why I cannot read the .config file.
Cheers...