2010-11-10 77 views
0

我的ASP.NET MVC 2應用程序有點奇怪的行爲。ASP.NET MVC 2&IIS:HTTP 500.24 favicon.ico錯誤

我正在使用IIS 7.5,Windows身份驗證和ASP.NET模擬來加載我的網頁。

經過幾次的搜索,我沒有找到一個很好的方式擺脫500.24要求我保持每天頁面加載得到的(在根目錄下的favicon.ico觸發此):

Fiddler

我看過一些文章,如this onethat one,但這似乎不能解決我的問題。我需要這些設置以供我的應用程序在此處工作:.NET 4 Framework集成模式管道,Windows驗證和ASP.NET模擬。

這裏是我的web.config的簡化版本,如果它可以幫助任何人(當然,我已經刪除的連接字符串出於安全原因..)

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
    <customErrors mode="Off" /> 
    <identity impersonate="true" /> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </assemblies> 
    </compilation> 
    <authentication mode="Windows"> 
     <!-- roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/--> 
     <!-- forms loginUrl="~/Account/LogOn" timeout="2880"/--> 
    </authentication> 
    <membership> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/Globe" /> 
     </providers> 
    </membership> 
    <profile> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/Globe" /> 
     </providers> 
    </profile> 
    <roleManager enabled="false"> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/Globe" /> 
     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/Globe" /> 
     </providers> 
    </roleManager> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Mvc" /> 
     <add namespace="System.Web.Mvc.Ajax" /> 
     <add namespace="System.Web.Mvc.Html" /> 
     <add namespace="System.Web.Routing" /> 
     </namespaces> 
    </pages> 
    </system.web> 
    <system.webServer> 
    <httpProtocol> 
     <customHeaders> 
     <add name="X-UA-Compatible" value="IE=edge" /> 
     </customHeaders> 
    </httpProtocol> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <remove name="WebDAVModule" /> 
    </modules> 
    <security> 
     <requestFiltering> 
     <verbs> 
      <add verb="PUT" allowed="true" /> 
      <add verb="DELETE" allowed="true" /> 
     </verbs> 
     </requestFiltering> 
    </security> 
    </system.webServer> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
    <system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
    </system.serviceModel> 
</configuration> 

我的應用程序工作時,圖標.ico正在加載,我只是想知道爲什麼它會在每個請求中觸發一個500.24(當然,也許是Fiddler不能對自身進行身份驗證並導致de 500.24 HTTP錯誤,但是當它正常執行時會觸發401.2 - 未經授權相反...)

+0

在網絡上的快速建議看起來是它的模擬=真。您是否嘗試過轉移到經典模式(由許多鏈接建議)以查看它是否有效。因爲我猜「」不適合你 – dbones 2010-11-10 22:23:07

+0

我不能使用經典模式,因爲我的應用程序需要集成管道,並且'和<驗證validateIntegratedModeConfiguration =「false」/>'已經在我的web.config中強制執行。 – LoganWolfer 2010-11-11 15:48:54

回答

2

我的猜測是,favicon.ico要麼在不同的應用程序池中運行,要麼在根目錄中有一個web.config有問題的網站。 因此: 1)檢查網站的根目錄(/favicon.ico所在的目錄)是否包含web.config。如果確實如此,請檢查它是否正在設置system.web/httpModule,httpHandler或system.web/identity(impersonate)或類似的東西,並且應用程序池以集成模式運行。

所以你需要做的是要麼刪除有問題的HTTP模塊/ HttpHandler的/冒充設置或更改應用程序池爲經典跑,或添加相同的配置你的網站包括爲<驗證validateIntegratedModeConfiguration =「假」/>

+0

我會研究這個,但是我確實需要集成管道,並且''對我沒有任何幫助。在C:\ inetpub \ wwwroot中確實有一個生成的web.config文件,我已經嘗試在wwwroot web.config中添加'',但仍未做任何更改。 impersonate = true也位於wwwroot的web.config中。我怎樣才能找出哪個httpmodule/httphandler導致這種情況?只有一個網站和一個應用程序,並且都使用相同的應用程序池。有任何想法嗎 ? – LoganWolfer 2010-11-11 16:13:29

0

CarlosAg說了些什麼。便宜的修復可能是將favicon移動到冒犯的應用程序中,而不是吠叫樹。

0

我找到了答案,以我的問題=)

你會笑我,肯定.. = P

那麼,答案的一部分,是在C <validation validateIntegratedModeConfiguration="false" />:\ CarlosAg指出的inetpub \ wwwroot,但另一部分是我忘了在我的ASP.NET MVC 2應用程序中將<link rel="icon" href="<%: Url.Content("~/favicon.ico")%>" type="image/x-icon" />添加到我的Site.Master文件中。由於Chrome和IE確實看到了favicon.ico的根目錄,它似乎可行,但直到現在Firefox並沒有加載收藏夾圖標,我沒有注意到。

現在,每個瀏覽器都加載了favicon,並且在Fiddler中沒有發送500.24 HTTP請求。

謝謝! =)