web.config ipSecurity的内部服务器错误

Sru*_*thi 14 asp.net iis web-config

这是我的web.config,它有一些阻止Ipaddress的标签

<configuration>
 <connectionStrings>
    ...
 </connectionStrings>
 <appSettings>
  ....
 </appSettings> 
 <runtime>
   ....
 </runtime>
  <system.webServer>
    <security> 
        <ipSecurity allowUnlisted="false"> 
            <clear/> 
             <add ipAddress="127.0.0.1" allowed="true"/>
             <add ipAddress="83.116.19.53" allowed="true"/> 
        </ipSecurity>  
    </security>
</system.webServer> 
</configuration>
Run Code Online (Sandbox Code Playgroud)

我的目的是阻止除上述之外的任何其他IP.以上是我希望从中访问网站的唯一IP地址.但是使用"ipSecurity"标签我总是得到500 - 内部服务器错误,没有它,网站运行正常.

我确保在服务器上安装了"IP和域限制".如果我遗失任何东西,请告诉我.谢谢.

Sum*_*mit 31

对于遇到此问题的其他人.问题的原因是功能委派不允许该功能由web.config管理.

修理:

验证是否已为web.config管理启用该功能

  • 在IIS 7中,单击根服务器
  • 双击功能委派(管理中)
  • 向下滚动到IPv4地址和域限制
    • 将委托更改为读/写(在我的情况下,它是只读,这是问题)

希望这有助于其他人.

  • 这解决了我的问题但在安装Win7之前看不到"IPv4地址和域限制" - >程序和功能 - >万维网服务 - >应用程序开发功能 - > ASP以及万维网服务 - >应用程序开发功能 - >安全 - > IP安全. (2认同)

Gre*_*ell 19

对于Windows 10和Visual Studio 2015,请注意ApplicationHost.config文件已重定位到项目文件夹层次结构中的.vs\config文件夹.您将需要编辑在那里找到的ApplicationHost.config文件的项目特定版本 ...

<section name="ipSecurity" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)

如果您只编辑Documents\IISExpress文件夹中的ApplicationHost.config,这不会影响您现有的应用程序(在我的情况下是MVC5应用程序).


小智 11

打开applicationHost.config文件(位于%windir%\ system32\inetsrv\config\applicationHost.config)并编辑ipSecurity部分.

改变这一行:

<section name="ipSecurity" overrideModeDefault="Deny" />
Run Code Online (Sandbox Code Playgroud)

至:

<section name="ipSecurity" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)


Bro*_*ley 6

您是手动编辑配置还是通过IIS管理器编辑配置?

有关该错误消息,请参阅此帖子,因为您可能没有启用该功能委派

http://forums.asp.net/t/1220987.aspx


Moh*_*ari 6

在 System.Webserver 标签之外试试这个

<location path="Default WebSite">
    <system.webServer>
        <security>
            <ipSecurity allowUnlisted="false">
                <clear/>                 
               <add ipAddress="127.0.0.1" allowed="true"/>
             <add ipAddress="83.116.19.53" allowed="true"/> 
            </ipSecurity>
        </security>
    </system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)