TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Getting Client IP in WCF Service
Kailash Chandra Behera
Aug 17
2015
Code
17.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
private
string
GetClientAddress()
{
// creating object of service when request comes
OperationContext context = OperationContext.Current;
//Getting Incoming Message details
MessageProperties prop = context.IncomingMessageProperties;
//Getting client endpoint details from message header
RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name]
as
RemoteEndpointMessageProperty;
return
endpoint.Address;
}
IP
WCF Service
request header