asp net core 2. * IpRestrictionModule

时间:2018-01-08 08:40:08

标签: asp.net asp.net-core .net-core asp.net-core-2.0 asp.net-core-1.0

asp net core 1. *曾经与IpRestrictionModule合作,现在它没有...这里是我的设置

<system.webServer>
    <!--http://www.henrihietala.fi/limit-access-to-your-azure-web-app-by-ip-address-asp-net-core/-->
    <!--http://www.sasanyeganegi.com/2013/12/how-to-restrict-access-by-ip-in-aspnet.html-->
    <security>

      <!-- this line blocks everybody, except those listed below -->
      <ipSecurity allowUnlisted="true">

        <!-- removes all upstream restrictions -->
        <clear/>

        <!-- allow requests from the local machine -->
        <add ipAddress="127.0.0.1" allowed="true"/>

        <!--allow network 83.116.119.0 to 83.116.119.255-->
        <!--<add ipAddress="83.116.119.0" subnetMask="255.255.255.0" allowed="true"/>-->

        <!-- allow the specific IP of 83.116.19.53  -->
        <add ipAddress="83.116.19.53" allowed="true"/>

        <!--allow network 83.116.0.0 to 83.116.255.255-->
        <!--<add ipAddress="83.116.0.0" subnetMask="255.255.0.0" allowed="true"/>-->

        <!--allow entire /8 network of 83.0.0.0 to 83.255.255.255-->
        <!--<add ipAddress="83.0.0.0" subnetMask="255.0.0.0" allowed="true"/>-->

      </ipSecurity>

    </security>
</system.webServer>

以下是错误:

Detailed Error Information:

Module      IpRestrictionModule
Notification    BeginRequest
Handler     aspNetCore
Error Code  0x80070021
Config Error    This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Config File \\?\C:\Users\XXXXXXX\repos\YYYY\ZZZZZ\web.config

Config Source:
   13:       <!-- this line blocks everybody, except those listed below -->
   14:       <ipSecurity allowUnlisted="true">
   15: 

做了asp.net核心2. *改变了IpRestrictionModule的实施方式?

1 个答案:

答案 0 :(得分:0)

我的localhost(位于 C:/ Windows / System32 / drivers / etc / hosts )有

var date = new Date()

所以http://localhost:3023选择了最后一个:: # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 并且它不是IP地址,因此::1永远无法解决它。