Calling WebService From Same Project
- by Yehia A.Salam
Hi,
I'm trying to call an asp.net webservice from the same project it's in:
[MethodImpl(MethodImplOptions.Synchronized)]
public static void OnFileCreated(object source, FileSystemEventArgs e) {
trackdata_analyse rWebAnalyse = new trackdata_analyse();
rWebAnalyse.Analyse(@"pending\" + e.Name, "YOUNIVATE");
}
However i always get the following "HttpContext is not available. This class can only be used in the context of an ASP.NET request." when calling Server.MapPath from the webservice:
[WebMethod]
public int Analyse(string fileName, string PARSING_MODULE){
int nRecords;
TrackSession rTrackSession = new TrackSession() ;
string filePath = Server.MapPath(@"..\data\") + fileName;
do i have to add the WebReference instead, though the webservice is in the same project?
Thanks In Advance