I have a wcf service thats exposing a service using two endpoints. One endpoint is used for web service calls while the other is using rest.
Is there a way to determine from which endpoint the server functions are being called?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually, contrary to what I thought – it’s actually pretty easy to find out what endpoint the service was called on. In your service method, add these lines of code:
But as I said : I would use this very wisely and “defensively” – don’t start changing service behavior based on what endpoint your method was called on – that would be very bad design!
I tried this with several SOAP endpoints – not 100% sure how REST will be handled (but most likely the same or very similarly) – try it out!
But for logging, this should work just fine!