【茶包射手日記】IIS 7限制IP存取的設定錯誤

在IIS 7.5執行某個ASP.NET程式時發生以下錯誤:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:
Module: IpRestrictionModule
Notification: BeginRequest
Handler: PageHandlerFactory-Integrated
Error Code: 0x800700b7
Config Error: Cannot add duplicate collection entry of type 'add' with combined key attributes 'ipAddress, subnetMask, domainName' respectively set to '192.168.1.73, 255.255.255.255, '
Config File: Unavailable (Config Isolation)

Config Source:
<ipSecurity> <add ipAddress="192.168.1.73" allowed="true" /> </ipSecurity>

看起來好像是我設的IP存取限制發生衝突,不過我一直都是用IIS Manager設定的,不知為何會冒出這種錯誤。於是我開啟IIS管理員要檢視有問題Web Application的"IP Address and Domain Restrictions"設定時,冒出以下錯誤:

---------------------------
IP Address and Domain Restrictions
---------------------------
There was an error while performing this operation.

Details:

Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config

Line number: 1719

Error: Cannot add duplicate collection entry of type 'add' with combined key attributes 'ipAddress, subnetMask, domainName' respectively set to '192.168.1.73, 255.255.255.255, '

這裡的訊息明確很多,直指問題出在applicationHost.config。找到該檔案,果然查到所謂"重覆"是什麼:

預設網站有此192.168.1.73的設定:

<location path="Default Web Site">
    <system.webServer>
        <security>
            <ipSecurity allowUnlisted="false">
                <add ipAddress="127.0.0.1" allowed="true" />
                <add ipAddress="192.168.1.73" allowed="true" />
            </ipSecurity>
        </security>
    </system.webServer>
</location>

該Web Application裡也有相關設定:

<location path="Default Web Site/PlayGround">
    <system.webServer>
        <security>
            <ipSecurity>
                <add ipAddress="192.168.1.73" allowed="true" />
            </ipSecurity>
        </security>
    </system.webServer>
</location>

將Default Web Site/PlayGround的<add ipAddress="192.168.1.73" allowed="true" />設定刪除,問題就解決了。但從未手動修改此檔,一向都只用IIS管理員設定,為何會搞出這種矛盾錯誤,原因成謎...

歡迎推文分享:
Published 28 May 2010 02:57 PM 由 Jeffrey
Filed under: ,
Views: 17,176



意見

沒有意見

你的看法呢?

(必要的) 
(必要的) 
(選擇性的)
(必要的) 
(提醒: 因快取機制,您的留言幾分鐘後才會顯示在網站,請耐心稍候)

5 + 3 =

搜尋

Go

<May 2010>
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
 
RSS
創用 CC 授權條款
【廣告】
twMVC

Tags 分類檢視
關於作者

一個醉心技術又酷愛分享的Coding魔人,十年的IT職場生涯,寫過系統、管過專案, 也帶過團隊,最後還是無怨無悔地選擇了技術鑽研這條路,近年來則以做一個"有為的中年人"自許。

文章典藏
其他功能

這個部落格


Syndication