G
Guest
Hi,
I have a Windows Service that uses a referenced dotnet-dll.
In my dll I set some public string to a stringvalue that I
get from reading a xml-file(my config file). It works fine
if I use it in a vb-form. But since Windows Services ?
executes? in windows\system32 I can´t locate my xml-config-
file.
I don´t want to set different "compiling-statements" such
as :
#IF CONFIG = "service2" then
xmlPath = "c:\kklk\service2"
#ELSEIF CONFIG="service3" then
xmlPath = "c:\kklk\service3"
#END IF
I want to return the location of the directory where my
service is. Not the "running" location of the service
("windows\system32"). Everything I try returns
c:\windows\system32
Is there some way of doing the following??
--- myClass.dll
Public ReadOnly strPathName As String = GetPath("path1")
Private Function GetPath(ByVal strValue As String) As
String
Dim oConf As New mmmmXML.XMLConfigurator
(Environment.CurrentDirectory().ToString
& "/XMLConfigurator.xml") '<== get the directory of where
the dll and service-code resides. This doesn´t work
Dim strPath As String
strPath = oConf.GetXPathValue("/mmmmCONFIG/mmmmPATH
[@name='" & strValue & "']/@path")
Return strPath
End Function
I have a Windows Service that uses a referenced dotnet-dll.
In my dll I set some public string to a stringvalue that I
get from reading a xml-file(my config file). It works fine
if I use it in a vb-form. But since Windows Services ?
executes? in windows\system32 I can´t locate my xml-config-
file.
I don´t want to set different "compiling-statements" such
as :
#IF CONFIG = "service2" then
xmlPath = "c:\kklk\service2"
#ELSEIF CONFIG="service3" then
xmlPath = "c:\kklk\service3"
#END IF
I want to return the location of the directory where my
service is. Not the "running" location of the service
("windows\system32"). Everything I try returns
c:\windows\system32
Is there some way of doing the following??
--- myClass.dll
Public ReadOnly strPathName As String = GetPath("path1")
Private Function GetPath(ByVal strValue As String) As
String
Dim oConf As New mmmmXML.XMLConfigurator
(Environment.CurrentDirectory().ToString
& "/XMLConfigurator.xml") '<== get the directory of where
the dll and service-code resides. This doesn´t work
Dim strPath As String
strPath = oConf.GetXPathValue("/mmmmCONFIG/mmmmPATH
[@name='" & strValue & "']/@path")
Return strPath
End Function