كيفية استرداد اسم آلة العميل من داخل عقد تشغيل WCF؟
-
15-11-2019 - |
سؤال
أنا أتطلع حاليا إلى OperationContect.current خصائص.هل هناك خاصية (متداخل)، ستعود دائما اسم الجهاز للعميل؟أنا حاليا باستخدام NET.TCP ملزمة، ولكن أود دعم الارتباطات الإضافية في المستقبل.
باستخدام .NET 3.5 SP1
المحلول
You can get the remote endpoint's IP address from the current OperationContext's IncomingMessageProperties, eg:
RemoteEndpointMessageProperty messageProperty = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
Console.WriteLine("Remote address is: {0}", messageProperty.Address);
لا تنتمي إلى StackOverflow