Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
696 views
in Technique[技术] by (71.8m points)

asp.net - Internal Server Error with web.config ipSecurity

This is my web.config which has some tags for blocking 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>

My intention is to block any other IP except the above. The above is the only Ip address I want the website to be accessible from . But with "ipSecurity" tag I am always getting 500 - Internal server error and the site runs fine without it.

I have made sure that "IP and Domains Restrictions" are installed on the server. Please let me know if I am missing anything. Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For others that run into this issue. The cause of the issue is that Feature Delegation doesn't allow the feature to be managed by web.config.

To Fix:

Verify that the Feature is enabled for web.config management

  • In IIS 7, click on the root server
  • Double click Feature Delegation (under management)
  • Scroll down to IPv4 Address and Domain Restrictions
    • Change the delegation to Read/Write (in my case it was Read Only, which was the issue)

Hope this helps someone else.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...