silverlight   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Silverlight中利用WCF获取客户端IP大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

public class service1 : Iservice1 { public String DoWork() { OperationContext operationContext = OperationContext.Current; messageProperties messageProperties = operationCont
public class service1 : Iservice1
{
     public String DoWork()
     {
        OperationContext operationContext = OperationContext.Current;
        messageProperties messageProperties = operationContext.IncomingmessageProperties;
        RemoteEndpointmessageProperty remoteEndpointProperty = messageProperties[RemoteEndpointmessageProperty.Name] as RemoteEndpointmessageProperty;
 
        return String.Format("Your IP address is {0} and your port is {1}",remoteEndpointProperty.Address,remoteEndpointProperty.Port);
     }
}



public partial class Page : UserControl
{
    public Page() 
    {
          InitializeComponent();
          serviceReference1.service1Client client=new GridSplitterSample.serviceReference1.service1Client();
          client.DoWorkCompleted += new EventHandler<GridSplitterSample.serviceReference1.DoWorkCompletedEventArgs>(client_DoWorkCompleted);
          client.DoWorkAsync();
   }
 
   void client_DoWorkCompleted(object sender,GridSplitterSample.serviceReference1.DoWorkCompletedEventArgs E)
   {
        TextBlock myBlock=new TextBlock();
        myBlock.Text=e.Result;
        LayoutRoot.children.Add(myBlock);
   }
}

大佬总结

以上是大佬教程为你收集整理的Silverlight中利用WCF获取客户端IP全部内容,希望文章能够帮你解决Silverlight中利用WCF获取客户端IP所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。