I am very new to WCF.I have a WCF service hosted using a console application but, the WCF needs to be called from a C# webservice hosted on the same machine. So how can I restrict the endpoint access to loopback ip, i.e 127.0.0.1
Right now I can access the WCF service endpoints hosted in a different machine(say 10.X.X.X) .For example I can type http://10.X.X.X/api/v1/getStatus and get the response. This url should be restricted. My requirement is only http://localhost/api/v1/getStatus should be able to fetch the response from the WCF service hosted.
In the link you gave, IPFilter is a custom node that implements the IDispatchMessageInspector interface to intercept IP. Here is my demo:
We need to implement the IDispatchMessageInspector interface. When the server sends a response to the client, first determine whether the client's IP address is localhost. If it is not localhost, the server will return an empty response.
Then we need to add ServerMessageLogger to the behavior of the service.
Finally, you need to apply CustContractBehavior to the service.