Blog Archives

WCF Service Library in Windows Service

References
CodeProject (WCF Service in Windows Service), http://www.codeproject.com/KB/WCF/WCF_windows_hosting.aspx
MSDN (Debug Windows Service Applications), http://msdn.microsoft.com/en-us/library/7a50syb3(v=vs.80).aspx
MSDN (Host WCF Service in Managed Windows Service), http://msdn.microsoft.com/en-us/library/ms733069.aspx

Get IP Address of Originating Website From a Webservice

The following code was used in a .Net 3.5 web service to retrieve the IP Address of the website consuming it.

This solution may initially escape you since it might seem like the web service should run within an HTTP Context and thus utilize this object to get information from websites calling particular methods.

See MSDN reference(s) for more information.

C#:

RemoteEndpointMessageProperty clientEndpoint = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; 

clientEndpoint.Address 

References:
MSDN, http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.remoteendpointmessageproperty.aspx

Follow

Get every new post delivered to your Inbox.