简体   繁体   中英

How to get server endpoint address from client callback method (wcf duplex contract)

I have a duplex WCF contract and I want to get server endpoint address from client callback method (I'm using single client and many servers, so I want to know which server responds to me). Is there a way to get it from the OperationContext?

public class CallbackService : IServiceCallback
    {
        public void OnSuccess()
        {
            string endpoint = OperationContext.Current.?
            MessageBox.Show(string.Format("Process on {0} successfully finished!", endpoint));
        }
    }

I saw this question and tried the solution, but it responds with something unmeaningful to me: "fe80::1845:e7eb:abbb:77aa%13".

And here is what I want to get:

<endpoint address="http://localhost:5678/WinFormsHoster/wsDual">

Thanks in advance!

这是正确的地址,您正在使用IPv6。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM