2011-04-13 61 views
0

我從來沒有見過這樣的事情。嘗試了我所能做的一切,沒有運氣搜索網絡,最後我完全不知道發生了什麼。我敢打賭,這將是一個很容易修復bug的傻瓜,儘管我沒有完全理解fif/gif關鍵問題 - 對我來說太過於超現實。'System.Web.MimeMapping'的類型初始值設定項引發異常:Item已被添加。鍵入字典:'.fif'添加鍵:'.gif'

更多信息:當前運行的MVC3(從1升級到2到3),問題是間歇性的(有時發生在網站負載上,有時需要幾分鐘或幾分鐘才能發生),直接在Visual Studio上運行網站。

任何幫助,非常感謝!


Server Error in '/' Application. 

Item has already been added. Key in dictionary: '.fif' Key being added: '.gif' 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Item has already been added. Key in dictionary: '.fif' Key being added: '.gif' 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[ArgumentException: Item has already been added. Key in dictionary: '.fif' Key being added: '.gif'] 
    System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9360827 
    System.Collections.Hashtable.Add(Object key, Object value) +11 
    System.Web.MimeMapping..cctor() +2038 

[TypeInitializationException: The type initializer for 'System.Web.MimeMapping' threw an exception.] 
    System.Web.MimeMapping.GetMimeMapping(String FileName) +23 
    System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) +761 
    System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +347 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8862964 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.431 
+0

您是否考慮過展示您的代碼? – 2011-04-14 06:34:58

+0

現在這是一個有趣的,沒有。我只能發現發生了什麼,因爲我沒有刷新頁面,而是複製了JavaScript文件的位置並從瀏覽器加載。 Visual Studio沒有發現任何問題,它只顯示上面複製問題的黃頁。我很高興分享特定的代碼段,如果有幫助,但我想不出什麼。 – Eddie 2011-04-14 10:09:40

回答

0

所以這裏的交易:

顯然,還有用 「CY-GB」 文化比較器,這又引起了奇FIF/GIF問題的問題。

此處瞭解詳情:http://forums.iis.net/p/1175210/1979005.aspxhttps://connect.microsoft.com/VisualStudio/feedback/details/661862/system-web-mimemapping-static-constructor-crash-due-to-incorrect-string-comparer-use

什麼引起我注意的是,這種文化正在從應用程序中挑選,而原因是因爲FirstOrDefault(),其中兩個字母的ISO代碼==「國標」的。現在已經解決了,問題不再發生,但「cy-GB」文化缺陷仍然需要修復(上面提供的MS Connect鏈接)。

希望這可以幫助任何有類似問題的人。

0

我剛剛有這個完全相同的問題。感謝您指出原因,埃迪。

這是我做我的Windows XP機器上解決這個問題:

轉到Control Panel > Regional and Language Options > Regional Options (tab) > Standards and formats。然後從下拉菜單中選擇English (United Kingdom),而不是Welsh

相關問題