【问题标题】:Web.config 500 block ipaddress - Internal server errorWeb.config 500 阻止 ipaddress - 内部服务器错误
【发布时间】:2012-10-12 18:17:12
【问题描述】:

这是我的 web.config,其中有一些用于阻止 IP 地址的标签

<system.webServer>
<defaultDocument enabled="true">
  <files>
    <clear/>

    <add value="Default.aspx"/>
  </files>
</defaultDocument>
<modules runAllManagedModulesForAllRequests="true"/>
<security>

  <ipSecurity allowUnlisted="false">

    <clear/>

    <add ipAddress="21.2.22.2" allowed="true"/>

  </ipSecurity>
    </security>

所以我的意图是阻止除上述之外的任何其他 IP。 以上是我希望网站可以访问的唯一 IP 地址。 但这是我收到的错误

500 - 内部服务器错误。 您要查找的资源有问题,无法显示。

我的网站托管在月球页面上。因此,根据我所指的http://www.stokia.com/support/misc/web-config-ip-address-restriction.aspx,IP 地址是客户端地址。所以它应该与托管服务提供商没有任何关系。

谢谢

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    这可能会有所帮助。我在无法访问 IIS 的站点上使用它。它成功地阻止了单个 IP 地址。可能可以修改为只允许某些 IP 地址。

    http://www.hanselman.com/blog/AnIPAddressBlockingHttpModuleForASPNETIn9Minutes.aspx

    【讨论】:

      【解决方案2】:

      我怀疑您是否可以在 web.config 级别执行此操作,除非在服务器本身上安装了“IP 和域限制”角色。在此处查看文章http://www.iis.net/configreference/system.webserver/security/ipsecurity

      【讨论】:

        猜你喜欢
        • 2023-03-15
        • 2012-03-29
        • 2015-11-25
        • 2019-01-17
        • 2011-10-17
        • 2010-11-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多