I have a windows service that uses a method from a class library with the same asp.net solution. in the class library I have a method with the following line:
reader = XmlReader.Create(HttpContext.Current.Server
.MapPath("~/TestDevice/Data.xml"), settings);
When control passes to this line. I get an exception. I tried to debug the code and found that when the service tries to access this method, then HttpContext.Current.Serverthere is null. What is an alternative syntax.
I tried to access this class library method from a web application and it works fine.
Please suggest a solution.
source
share