24 March 2010 0 Comments

Overwriting the service root URI in Wcf Data Service

Suppose you are hosting a WCF Data Service on a particular URL, but for some reason you’d like the consumers of your service to hit another URI – perhaps an IIS re-write, or a cookieless session. You can do this via setting one of the custom properties in the OperationContext: OperationContext.Current.IncomingMessageProperties[" MicrosoftDataServicesRootUri "] = serviceUri; You need to do this per instance of the data service, so it makes a lot of sense to do it in the service class’ constructor. Normally, WCF data service will try to resolve the absolute service URI by asking the underlying host.

View post: 
Overwriting the service root URI in Wcf Data Service

If you liked this post, buy me a Coffee.

Leave a Reply