473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Reading XML from a Windows service

jdm
Using the function below, I'm importing configuration parameters, from
an xml file, into a Windows service. This code works as expected in a
regular Windows application, but when used in a Windows service
(written in vb.net), it produces unintended side effects. The most
notable being multiple (and simultaneous) firings of timer events. Is
there a better way? Thank you.

Private Function MyNodeValue(ByVal strPath As String)
'This function reads a value from an XML file.
Dim xmlDoc As New System.Xml.XmlDocument
xmlDoc.Load(strPathToXMLfile)
Try
MyNodeValue = xmlDoc.SelectSingleNode(strPath &
"/text()").Value()
Catch
'Throw the error back to the calling routine.
Throw
End Try
End Function

Nov 12 '05 #1
1 2297
The code appears unlikely to cause the problems you describe.

Without seeing the calling code, I can only guess. So here's my SWAG: you
mention what will happen if the config document cannot be read by the web
service due to permissions errors. I assume that this code is within a
try-catch somewhere. Is that try-catch at the event level, which makes it
look like the code is triggering another event?
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"jdm" <ja**********@pnl.gov> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Using the function below, I'm importing configuration parameters, from
an xml file, into a Windows service. This code works as expected in a
regular Windows application, but when used in a Windows service
(written in vb.net), it produces unintended side effects. The most
notable being multiple (and simultaneous) firings of timer events. Is
there a better way? Thank you.

Private Function MyNodeValue(ByVal strPath As String)
'This function reads a value from an XML file.
Dim xmlDoc As New System.Xml.XmlDocument
xmlDoc.Load(strPathToXMLfile)
Try
MyNodeValue = xmlDoc.SelectSingleNode(strPath &
"/text()").Value()
Catch
'Throw the error back to the calling routine.
Throw
End Try
End Function

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sauron | last post by:
Hi all I have created a Service that will listen for incoming requests from client computers and communicate with my .NET remoting objects to send data back. My problem is when I start the...
0
by: jd_miller | last post by:
Using the function below, I'm importing configuration parameters, from an xml file, into a Windows service. This code works as expected in a regular Windows application, but when used in a Windows...
3
by: timb | last post by:
Hi, I have created a windows service which is responsible for running certain tasks when they are scheduled to run. The service monitors a sql table and runs a task when the task scheduled time...
5
by: Dhilip Kumar | last post by:
Hi All, I'm writing a Windows Service app using C#. I need to read some configuration settings before the service starts up. These settings will be used by the service in its operation. ...
2
by: Dan | last post by:
Hi there, I've got a WebService application that works fine under Windows 2000 with Framework 1.0 Installing it on Windows 2003 results in SoapExceptions being thrown when any of the methods...
3
by: Ahmad Jalil Qarshi | last post by:
Hi! I am developing an application in C# as a windows NT Service. This application needs to check for eventlog using EventLog.Exists("System") But unfortunately it generates exception...
12
by: Simon Hart | last post by:
Hi, I am using Impersonation and turned off anon access for my web service. I am using the administator to authenticate the request using ICredentials. I am simply trying to read a key in...
0
by: Salty Dog | last post by:
I have the config file named properly but maybe I don't have it in the proper location. I have it in the root of the project folder. Is there someplace that I need to configure the Windows...
0
by: jigsmshah | last post by:
I have a windows service developed in C#.I am reading the connection string from an ini file and also i am reading 3 image file from the bin directory. now the new requirement is that there will be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.