11

I read all the answers already posted here but none seems to solve. Elmah is working flawlessly even if I got those warnings. Also I got those errors when I launch debug (f5) in visual studio 2012. On build everything is fine.

Config section in web.config is straightforward so I really don't know how to solve it:

<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="dummy@dummy.com" to="dummy@dummy.com" subject="dummy" priority="High" async="true" smtpPort="25" smtpServer="dummy" useSsl="false" userName="dummy@dummy.com" password="dummy" noYsod="false" />
  </elmah>
tshepang
  • 12,111
  • 21
  • 91
  • 136
Manight
  • 500
  • 5
  • 26
  • 1
    For future reference, there's an ELMAH schema available on GitHub: https://github.com/elmahio/Elmah-Schema. You can read more about it and see an example on how to use it here: http://blog.elmah.io/the-elmah-schema/ – ThomasArdal Aug 15 '16 at 06:36
  • To get Intellisense to recognize the schema, at least in Visual Studio 2015, the schema root element must add the default namespace attribute referencing the target namespace: ``. – Suncat2000 May 03 '19 at 12:58

2 Answers2

10

I think this error is related to the fact that you have selected SqlErrorLog as your errorLog type. Did you run the Elmah SQL Server DB Script in the database that your EvaConnection connectionString is configured for? If not, you will need to do this, so that the correct tables and stored procedures are created for Elamh to use when writing errors to the database.

If you are using a later version of SQL Server than 2005, please see the note in the ErrorLog Implementation - Enterprise-Level Relational Databases wiki page for a note about the ntext field type.

Update:

After paying more attention to the question. Found a relevant post on the ELMAH Google Group - Could not find schema information This is an issue that Visual Studio reports about the ELMAH config section because it does not have a supporting .xsd file. There is a file available that can be used to suppress this error/warning message in Visual Studio. Just following the instructions from Issue 239: Intellisense for web.config and external config files

Paige Cook
  • 22,415
  • 3
  • 57
  • 68
  • Hi Cook, thanks for the reply. Of course SQL tables are set up and everything is working fine. Elmah is logging and sending emails as expected. I think it's just something tied to web.config but I really don't know how to solve it. I get the messages only during debug, upon build it's all ok. – Manight Dec 21 '12 at 10:16
  • 1
    Is there some sort of visual studio cache for such things as the web config schema? The schema for and it's attributes and elements should be read correctly from (and it is infact since everything works) but when starting debug I have "error" message (are configured as information message no error really). So I think maybe is some sort of caching of visual studio somewhere? – Manight Dec 21 '12 at 22:44
  • Thank you Cook. I was wondering if it's only me receiving those messages. – Manight Dec 25 '12 at 17:08
  • 1
    @Manight Yes, the "cache" can be accessed from the XML editor. The `Schemas` property in the Properties window will open a grid of all the schemata that VS knows about. You can add/remove and enable/disable schemas there. If you drop Elmah.xsd into your project and add the `xmlns="http://Elmah.Configuration"` attribute to your `` element, VS will add its schema to the list automatically. – Suncat2000 May 03 '19 at 13:04
  • I did this and the warning still pops up, and oddly it just goes away if I open the Elmah.xsd file. – Literate Corvette Oct 16 '20 at 20:53
3

I had everything working and then out of the blue I got this error too.

Before you try any of the more complicated solutions to this problem:

  1. Restart your Visual Studio
  2. Clean the solution
  3. Build the solution again

That solved the problem for me. It does seem like something got cached (or crashed) in Visual Studio.

swbandit
  • 1,986
  • 1
  • 26
  • 37