thank you everyone for your help. i now know the problem occurs if i try to write data to the .config file of the windows service using a StreamWriter immediately before starting the service. I'm assuming that my code is making the config file unreadable for the service?

Code:
Using swrConfigFile As New StreamWriter("C:\My Service.config")
        With swrConfigFile
                .WriteLine(strConfigData)
                .Close()
        End With
End Using

Dim scnService = New ServiceController("SERVICENAME", ".")
scnService.Start()
I know that the data being written to the file is correct and i've tried writing to the file in a Using statement and i've tried calling swrConfigFile.Dispose() once i've finished but i still get the error. any ideas?