I have a WCF web service that exposes several business methods. I also have two clients - an asp.net GUI and a data migration application that both connect to the wcf backen
You can solve this via a custom header.
You can add a custom header as part of the endpoint in the client application's configuration file. You would then make each client's custom header different. For example, in the ASP.NET version:
ASP_Client
Then the service can check the header value like so:
public void MyServiceMethod()
{
var opContext = OperationContext.Current;
var requestContext = opContext.RequestContext;
var headers = requestContext.RequestMessage.Headers;
int headerIndex = headers.FindHeader("ClientIdentification", "");
var clientString = headers.GetHeader(headerIndex);
if clientString=="ASP_Client"
{
// ...
}
else
{
// ...
}
}