I have SharePoint 2010 (_http: // sp2010 /, for example). I created a site (_http: // sp2010 / site /) and a WCF service, which is located in the ISAPI folder. In the service, I have a testing method like this:
[OperationContract]
public string GetCurrentWebUrl()
{
return SPContext.Current.Site.Url + " | " + SPContext.Current.Web.Url;
}
I call the service from my console application using this address - _http: //sp2010/site/_vti_bin/WcfService.svc/mex. When calling the GetCurrentWebUrl method, I expect to get _http: // sp2010 / site /, but always get _http: // sp2010 /. In other words, SPContext is incorrect.
What am I doing wrong? How can I get the right context?
Grant source
share