Below is the code to get the client endpoint in WCF:
public string GetClientEndpoint()
{
MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name]
as RemoteEndpointMessageProperty;
string s= string.Format("Client endpoint => {0}:{1}", endpoint.Address, endpoint.Port);
return s;
}
In case you are developing a custom transport channel, please refer to the following article:
http://blogs.msdn.com/b/phenning/archive/2007/08/08/remoteendpointmessageproperty-in-wcf-net-3-5.aspx
No comments:
Post a Comment