Calling WebService From Same Project
Posted
by Yehia A.Salam
on Stack Overflow
See other posts from Stack Overflow
or by Yehia A.Salam
Published on 2010-04-19T13:21:41Z
Indexed on
2010/04/19
13:23 UTC
Read the original article
Hit count: 417
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
© Stack Overflow or respective owner