Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot reference custom event from web.config
    primarykey
    data
    text
    <p>I've written a custom event <code>MyWebErrorEvent</code> derived from <code>WebErrorEvent</code> located in the App_Code folder of my ASP.NET 2.0 Web Site Project. The class <code>MyWebErrorEvent</code> is not contained within a namespace. I've put the following into my web.config file:</p> <pre><code>&lt;configuration&gt; &lt;system.web&gt; &lt;healthMonitoring&gt; &lt;eventMappings&gt; &lt;add name="Event1" startEventCode="0" endEventCode="2147483647" type="MyWebErrorEvent"/&gt; &lt;/eventMappings&gt; &lt;/healthMonitoring&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>At compile time and run time I get the following error:</p> <pre><code>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Could not load type 'MyWebErrorEvent'. Source Error: Line 16: &lt;healthMonitoring&gt; Line 17: &lt;eventMappings&gt; Line 18: &lt;add name="Event1" startEventCode="0" endEventCode="2147483647" type="MyWebErrorEvent"/&gt; Line 19: &lt;/eventMappings&gt; Line 20: &lt;/healthMonitoring&gt; </code></pre> <p>The class MyWebErrorEvent does indeed compile without errors. Anyone know how to fix this?</p> <p><strong>EDIT:</strong> <a href="http://msdn.microsoft.com/en-us/library/bb398933.aspx" rel="nofollow noreferrer"><a href="http://msdn.microsoft.com/en-us/library/bb398933.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb398933.aspx</a></a> says that this should work for custom events. A quote:</p> <blockquote> <p>Add the assembly that contains the custom Web event implementation to the Bin subdirectory of the ASP.NET application. Alternatively, you can add the event source code file to the App_Code subdirectory.</p> </blockquote> <p>However it also says this will not work for custom event providers:</p> <blockquote> <p>Put the assembly that contains the custom provider implementation in the application's Bin subdirectory. You cannot put the provider source code file in the App_Code subdirectory, because the health monitoring system is configured and created before any code files in the App_Code subdirectory are compiled. </p> </blockquote> <p>I'm guessing the documentation is actually incorrect about custom events and they must go into a assymbly distinct from the web site.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload