c# - Limit WCF service calls to local clients -
i trying open wcf service local use only.
i cant seem find way make listen on localhost (not allow remote connections wcf host)
here example code :
var baseuri = new uri("http://127.0.0.1:9001"); var webhost = new webservicehost(typeof(myservice), baseuri); webhost.addserviceendpoint(typeof(myservice), new webhttpbinding(), string.empty); webhost.open(); console.writeline("press key exit"); console.readline();
looking on resource monitor shows listen "unspecified ip".
how can force listen on localhost ?
you can set hostnamecomparisonmode on webhttpbinding
exact
, includes host name in endpoint matching.
the hostnamecomparisonmode value indicates whether hostname used reach service when matching on uri. default value strongwildcard, ignores hostname in match.
but using named pipes
better in case. more info see msdn.
Comments
Post a Comment