I am trying to set up a Publish/Subscribe system using WCF and where the WCF server is in a Windows service. The binding is net.TCP. The service is providing a \"Subscribe
I've faced this issue and non of the solutions worked and Most Important thing is if you're using
async await
OperationContext.Current; will be null
My usage is to get Ip so used it like this before any awaitable call
var clientIpAddress = System.Web.HttpContext.Current?.Request?.UserHostAddress;
After the first await statement in your async service operation, OperationContext.Current could be null because the rest of the method body may be running on a different thread (and OperationContext does not flow between threads
So to get it you can write your code before any awaitable action
May be it'll help someone :)