HttpContext.Current.Server null
问题 I have a windows service which is using a method from a class library with same asp.net solution. in class library, I have a method with following line: reader = XmlReader.Create(HttpContext.Current.Server .MapPath("~/TestDevice/Data.xml"), settings); When control comes to this line. I get exception. I tried to debug the code and found that when service tries to access this method then HttpContext.Current.Server is null . What is alternative syntax. I tried to access this class library method