ASP.NET WebForms app not sending errors

stevil

Posted on
Feb 06 2015

I'm not able to get my WebForms app to send errors to raygun. Any ideas for me about what to try?

I'm testing by throwing an exception in my default page's Page_Load event like this:

protected async void Page_Load(object sender, EventArgs e)
{
    throw new InvalidOperationException("Test error");
}

Here is my Web.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net"/>
  </configSections>
  <RaygunSettings apikey="[I removed this for obvious reasons...]"/>
  <system.web>
    <httpModules>
      <add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>
    </httpModules>
    <compilation debug="false" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
    <customErrors mode="On" defaultRedirect="~/ErrorPage"/><!--Turn on in production.-->
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <rewrite>
      <rules>
        <rule name="RewriteASPX">
          <match url="(.*)"/>
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
          </conditions>
          <action type="Rewrite" url="{R:1}.aspx"/>
        </rule>
      </rules>
    </rewrite>
    <defaultDocument>
      <files>
        <clear/>
        <add value="Launch.aspx"/>
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

stevil

Posted on
Feb 06 2015

No need to respond to this. Probably has something to do with IIS mode I'm running. I switched to trapping the errors in global.asax and removed this:

<httpModules>
      <add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>
</httpModules>

Now it works fine. In watching the training video on YouTube it became clear to me that configuring it using system.webServer vs. system.web had something to do with the mode of IIS ("integrated pipeline" etc). I'm hosting this out on azure and don't want or need to think about configuring IIS on that level.


Callum

Posted on
Feb 06 2015

Great to hear you got it working. On the off chance you've set the azure instance to Medium Trust, you can also set mediumTrust="true" on the RaygunSettings element to support this but depending on your config this may not be related to the cause of the issue.


Reply