Sunday, November 25, 2012

Enabled debugging log in .Net compiled app

To enable the log, change/add the following entries:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
"ForceLog"=dword:00000001
"LogFailures"=dword:00000001
"LogResourceBinds"=dword:00000001
"LogPath"="D:\\DebugLog\\"

Monday, November 19, 2012

Get client endpoint in WCF

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