我试图将某些 IP 地址限制为我的 Azure 托管 WCF 服务。我已遵循以下网站上列出的两个说明:
http://msdn.microsoft.com/en-us/library/windowsazure/jj154098.aspx
http://blog.elastacloud.com/2011/04/06/restricting-access-by-ip-in-azure-web-role-v1-4/
但我仍然可以从未列出的地址访问该服务。有什么我想念的吗?
这是cmd文件:
@echo off
@echo Installing “IPv4 Address and Domain Restrictions” feature
%windir%\System32\ServerManagerCmd.exe -install Web-IP-Security
@echo Unlocking configuration for “IPv4 Address and Domain Restrictions” feature
%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity
和 web.config 部分:
<system.webServer>
<security>
<!-- IP addresses are denied access -->
<ipSecurity allowUnlisted="false">
<!--The following IP addresses are granted access -->
<clear />
<add allowed="true" ipAddress="x.x.x.x" />
</ipSecurity>
</security>
</system.webServer>