I've got a C# Windows Service hosting a WCF Service (two separate projects). My WCF Service project implements IErrorHandler
, which I'd like to use to log errors to a file. My Windows Service is doing some logging to a file, and I'd like my IErrorHandler
to write to that same file.
How can I accomplish this (without hardcoding the filename in IErrorHandler
)?
Create a new static class with a public static filepath property In that class, load the filepath to the log file from the windows service app.config. Then also reference that class from your WCF service and you should be able to use the same value stored in the public static filepath property.