2012-12-17 49 views
8

我閱讀已發佈的所有答案,但似乎沒有解決。 即使我收到了這些警告,Elmah仍然完美無缺地工作。當我在visual studio 2012中啓動調試(f5)時,我也遇到了這些錯誤。構建一切都很好。在web.config中無法找到元素'elmah'的架構信息

配置部分很簡單,所以我真的不知道如何解決這個問題:

<configuration> 
    <configSections> 
    <sectionGroup name="elmah"> 
     <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" /> 
     <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" /> 
     <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" /> 
     <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" /> 
    </sectionGroup> 
    </configSections> 

    <elmah> 
    <security allowRemoteAccess="1" /> 
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="EvaConnection" /> 
    <!--<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/ErrorLogs" />--> 
    <!-- ELMAH class ErrorMailModule.cs has been modified to read config from AppSettings --> 
    <errorMail from="[email protected]" to="[email protected]" subject="dummy" priority="High" async="true" smtpPort="25" smtpServer="dummy" useSsl="false" userName="[email protected]" password="dummy" noYsod="false" /> 
    </elmah> 
+0

爲了將來的參考,GitHub上提供了一個ELMAH模式:https://github.com/elmahio/Elmah-Schema。你可以閱讀更多關於它,並看到如何在這裏使用它的例子:http://blog.elmah.io/the-elmah-schema/ – ThomasArdal

回答

9

我覺得這個錯誤與您所選擇SqlErrorLog爲您的錯誤日誌類型的事實。您是否在數據庫中運行Elmah SQL Server DB Script,您的EvaConnection connectionString配置爲?如果沒有,您需要這樣做,以便在向數據庫寫入錯誤時爲Elamh創建正確的表和存儲過程。

如果您使用的是比2005更高版本的SQL Server,請參閱ErrorLog Implementation - Enterprise-Level Relational Databases wiki頁面中的註釋,以獲取有關ntext字段類型的註釋。

更新:

更加關注的問題後。在ELMAH Google Group - Could not find schema information上找到相關文章這是Visual Studio報告有關ELMAH配置部分的問題,因爲它沒有支持的.xsd文件。有一個可用於在Visual Studio中禁止此錯誤/警告消息的文件。只要按照從Issue 239: Intellisense for web.config and external config files

+0

嗨,庫克,感謝您的答覆。當然,SQL表格是設置好的,一切正常。 Elmah正在按預期記錄和發送電子郵件。 我認爲這只是綁定到web.config,但我真的不知道如何解決它。我只在調試過程中收到消息,一旦編譯就可以了。 – Manight

+1

是否有某種類型的視覺工作室緩存用於Web配置模式等事情? 及其屬性和元素的模式應該從中正確讀取(並且事實上是一切正常),但是當開始調試時,我有「錯誤」消息(配置爲信息消息,沒有錯誤)。所以我想可能是某種地方的視覺工作室緩存? – Manight

+0

謝謝庫克。我想知道是否只有我收到這些消息。 – Manight

0

指示我已經一切工作,然後突然間我也得到了這個錯誤。

在嘗試任何對這個問題更復雜的解決方案:

  1. 重新啓動Visual Studio的
  2. 清潔液
  3. 構建解決方案再次

這解決了這個問題爲了我。它看起來像是在Visual Studio中被緩存(或崩潰)的東西。

相關問題