Reputation: 22458
I created a WCF service and hosted it on the Internet.
I wanna consume it from somename1.com
and some static IPs.
Can we say to WCF to just response to requests from somename1.com
domain (or multiple specific domains) or from some static IPs
Edit: What about the following config from http://forums.asp.net/t/1598209.aspx:
<endpoint address="" binding="wsHttpBinding" contract="IMyTestService">
<identity>
<dns value="ip address or domain name" />
</identity>
</endpoint>
Upvotes: 1
Views: 661
Reputation: 127603
Yes, this can be done by having your service endpoint use a Message Filter.
Here is a in depth Code Project article that goes step by step how to make a IP filter in WCF. Here is a example of it in use once you write the IPFilter class
<?xml version="1.0" encoding="utf-8" ?>
<!-- Example configuration -->
<configuration>
<configSections>
<section name="IPFilter"
type="IPFilter.Configuration.IPFilterConfiguration,IPFilter"/>
</configSections>
<IPFilter>
<HttpModule FilterName="Default" />
<Filters>
<add Name="Default" DefaultBehavior="Deny">
<deny hosts="192.168.11.12,192.168.1.*" />
<allow hosts="192.168.0.0/16" />
<deny hosts="*" />
</add>
</Filters>
</IPFilter>
</configuration>
Upvotes: 3