Get WCF svc url from code behind

Posted: March 28, 2012 in WCF
Tags: ,

My previous post,I have given a small tip on how to get the page url in code behind from ASP.net,this one is to get the same url from a WCF service.

public string IM_Ping()
{
System.Uri uri = System.ServiceModel.OperationContext.Current.IncomingMessageHeaders.To;
return uri.AbsoluteUri;
}

Output:

http://localhost:42468/Restful.svc/v1/IM_Ping

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s