【问题标题】:Windows Azure with WCF web role and restricting IPs via web.config具有 WCF Web 角色并通过 web.config 限制 IP 的 Windows Azure
【发布时间】:2013-10-24 18:07:38
【问题描述】:

我正在尝试仅将某些 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>

【问题讨论】:

  • 你确定启动任务运行成功了吗?将 RDP 放入框中,看看您是否可以在服务器上本地运行命令。我这样说的原因是我遇到了 startup.cmd 文件由于编码而无法运行的问题。如果您使用 Visual Studio 编写 startup.cmd 文件,请尝试使用 File |高级保存选项并选择 UTF-8 无签名选项。
  • 谢谢。我对 Azure 有点陌生,所以我不知道你可以 RDP 担任这个角色。我做了,发现第一个命令失败了。我猜是因为它在 2012 年的服务器上。我打算用 Power Shell 做同样的事情,并使用以下 Cmdlet technet.microsoft.com/en-us/library/jj205467.aspx

标签: wcf security azure config


【解决方案1】:

感谢 Rick Rainey,我发现我可以 RDP 进入网络角色并手动运行脚本。我发现脚本的第一部分失败了,因为该应用程序在服务器 2012 上运行。我将其更改为:

powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Web-IP-Security"

现在一切都按预期进行......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多