I am attempting to follow this article:
http://www.codeproject.com/KB/aspnet/elmahGAC.aspx
to get Elmah working from the GAC rather than needing to be setup for each application individually. Everything works locally but when the settings are set globally, Elmah stops logging. I read somewhere that if Elmah is running from the GAC then the settings should be in the "global" machine.config vs the "global" web.config but I've tried both. Right now, I'm at a point where if I add this:
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=abc123" preCondition="managedHandler" />
</modules>
</system.webServer>
into my application's web.config, it picks up the rest of the settings from the global machine.config and logs successfully. To answer the obvious question, yes I have this section in the global machine.config and have even tried entering it in the global web.config but still logging won't work. Anyone have any ideas? Is there anyway to get Elmah to display its errors instead of failing quietly?
EDIT: Here is my "global" machine.config file. It's just the default one with the stuff for ELMAH added and some section groups taken out to meet the char limit. I should probably also note this is running in IIS7.
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
</sectionGroup>
</configSections>
<connectionStrings>
<clear />
<add name="Elmah.Sql" connectionString="IMNOTTELLING" providerName="System.Data.SqlClient" />
<add name="LocalSqlServer" connectionString="IMNOTTELLING" providerName="System.Data.SqlClient" />
</connectionStrings>
<elmah>
<security allowRemoteAccess="0" />
<errorLog type="Elmah.SqlErrorLog, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" connectionStringName="Elmah.Sql" />
</elmah>
<runtime />
<system.data>
<DbProviderFactories />
</system.data>
<system.serviceModel>
Nothing tampered with here
</system.serviceModel>
<system.web>
<processModel autoConfig="true"/>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
</httpModules>
<compilation>
<assemblies>
<add assembly="Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" />
</assemblies>
</compilation>
<membership>
Nothing tampered with here
</membership>
<profile>
<providers>
<add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</profile>
<roleManager>
Nothing tampered with here
</roleManager>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests ="true">
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" preCondition="managedHandler" />
</modules>
<handlers>
<add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah, Version=1.2.13605.0, Culture=neutral, PublicKeyToken=e50dbdd41da277ac" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
EDIT: I installed the modules and handler in IIS directly and now it works.
I also had problems with IIS7 on a Win7x64 install (testing for a production system). I finally got this working by putting the module and handler into the appropriate nodes in the applicationHost.config file.
C:\Windows\System32\inetsrv\config\applicationHost.config
It seems that IIS7 ignores certain areas of the main framework web.config files, instead using the applicationHost.config file for IIS settings.
Something to note about that file if you are on a 64 bit install: it seems that 32 bit applications (including Visual Studio) will appear to not see the file. It's because of some file system behavior due to the OS being 64 bit. One easy work around is to open it using an UNC path:
\\localhost\c$\Windows\System32\inetsrv\config\applicationHost.config
I really doubt the PublicKeyToken of Elmah is abc123... You need to use the real PublicKeyToken, which you can find if you look at the assembly in the GAC. It looks something like: b03f5f7f11d50a3a (that was for mscorlib.dll, so that is Microsoft's public key token).
EDIT: I installed the modules and handler in IIS directly and now it works.
I've tried everything I could find to get ELMAH working from the GAC on my Win7 Ultimate 64bit machine and the only thing that finally got it working was registering the elmah.axd handler and the various modules in IIS Manager.
Related
First off, here's a few of the potential duplicates that didn't help:
Can't access /elmah on production server with Elmah MVC?
ELMAH doesn't insert error logs to SQL DB on production
ELMAH works on local machine, but not on production
Elmah, convert to .Net4 vs2010, run on server 2008, does not work
Cannot open database "test" requested by the login. The login failed. Login failed for user 'xyz\ASPNET'
The error "Login failed for user 'NT AUTHORITY\IUSR'" in ASP.NET and SQL Server 2008
My ASP.NET MVC application uses one SQL Server database and ELMAH uses another. On the test server, the IIS app pool account is used to connect to SQL Server, as intended, and everything works fine. However, moving to production with the same settings has Entity Framework continuing to use the IIS APPPOOL\Product Windows account to connect to SQL Server, but ELMAH starts attempting to use the DOMAIN\MACHINENAME$ account (which I didn't create/set up -- I don't know enough about Windows domains to know where that comes from).
Attempting to go to the ELMAH page that lists errors (i.e. http://localhost/elmah) returns HTTP 500 and the event log shows this classic error message:
Cannot open database "Errors" requested by the login. The login failed. Login failed for user 'DOMAIN\MACHINENAME$'
Out of desperation, I've tried just giving DOMAIN\MACHINENAME$ database permissions (used SSMS to map the login to the Errors database and selected db_datawriter and db_datareader), including the stored procedures suggested here, but even that doesn't work. That process is what I did to set it up on the test server.
Production is Windows Server 2012 R2 running IIS 8.5. Test is Windows 10 running IIS 10. Both are running SQL Server 2016 Express v13, for now.
Web.config with everything included that's even slightly related to this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<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>
<connectionStrings>
<clear />
<!-- Entity Framework connection, works fine on both servers -->
<add name="DbContext" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Data.mdf;Initial Catalog=Data;Integrated Security=True" providerName="System.Data.SqlClient" />
<!-- ELMAH connection, only works on test server -->
<add name="ElmahLog" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Errors.mdf;Initial Catalog=Errors;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="true" />
<add key="elmah.mvc.allowedRoles" value="Developer" />
<add key="elmah.mvc.route" value="dev/elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
<system.web>
<globalization culture="en-US" />
<authentication mode="Windows" />
<compilation debug="false" targetFramework="4.5.2">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<elmah>
<security allowRemoteAccess="true" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahLog" />
</elmah>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
</configuration>
Why is ELMAH using a different account and why can't I give that account permissions?
It sounds like your machines SID changed between development and deployment. Did you join the machine to a domain?
Or, you moved the Client from a non-domain computer to a domain joined computer?
A reinstall to correct the problem implies the SIDs either local or domain were not correct.
I have web.config inside the Views folder
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="PartyInvites" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
</appSettings>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
I also make sure the solutions Web.config is updated
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0"/>
</dependentAssembly>
But when i look at the views, i still get the error
Compiler Error Message: CS0103: The name 'Viewbag' does not exist in
the current context
Looks like my issue is an isolated case, VS tells me it get screwed after i updated some extension, i cannot remember what extension made it like this so i just repaired the installation of VS and it worked.
I had the same issue on Visual Studio 2015. It was resolved by updating the .Net Framework to use 4.5.2 instead of 4.0. This is done in the Properties page of the project.
I had this issue regardless of having all the correct configuration done in the web.config file.
Found out to be some bad files in the Component Cache, preventing the Razor views from recognising ViewBag, Model, and HtmlHelpers. Deleting these files solved the problem (good versions of these files were created next time I opened Visual Studio).
Please follow below path to discover the files:
C:\Users\your.name.here\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
Delete all four files:
Microsoft.VisualStudio.Default.cache
Microsoft.VisualStudio.Default.catalogs
Microsoft.VisualStudio.Default.err
Microsoft.VisualStudio.Default.external
I closed my project, deleted the files on that path and reopened my project, cleaned the solution and built it again and the problem was solved
Deleting your Temporary ASP.NET Files also helps. C:\Users\your.name.here\AppData\Local\Temp\Temporary ASP.NET Files.
Thanks!
Please i have been seeing this error:
The connection name 'SQL' was not found in the applications
configuration or the connection string is empty. 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.
I know for a fact that the connection name "SQL" exists and it works properly on my local machine.
I started seeing this error after i fixed this other error on my deployment server:
Compiler Error Message: BC31007: Unable to open module file
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
by setting up the access rights as suggested here
Please i would appreciate any help on this.
thanks!
Deployment Environment : Windows Server 2003, .net 4.0
Development Environment: Widows 7, .net 4.0
Please note: The deployed application has been working perfectly well on site, for over 3 months up till last Friday evening.
The client claims nothing on the server or in their environment has changed.
My Web Config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="LoginMode" value="2" />
<add key="CustomeModules" value="True" />
<add key="TopCallersRefeshInterval" value="600" />
<add key="OperatorAccountName" value="" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=C:\TempImageFiles\;"/>
</appSettings>
<connectionStrings>
<add name="SQL" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
<add name="SQLCustom" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0" explicit="true">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></assemblies>
</compilation>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<remove value="login.aspx" />
<remove value="iisstart.htm" />
<remove value="default.aspx" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
<add value="home.aspx" />
</files>
</defaultDocument>
<handlers>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
</configuration>
But, are you trying to connect to the remote database (i.e., the database on the deployment server) or to a local database.
Maybe somebody has touched the access privileges to the database...
By the way, how did you fixed the original error?
Delete every file(s) with .config format i.e. "web.user.config" but "web.config".
I hope it's help :)
Clear out the temp folder on your server. Recompile, redeploy and see if that fixes it for you. Also:
<connectionStrings>
<clear />
<remove name="SQL"/>
<add name="SQL"
connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;"
providerName="System.Data.SqlClient" />
.....
</connectionStrings>
If that does not work, try a remote debugging session:
How to: Set Up Remote Debugging
Try adding </clear> under your connection strings in web.config
connectionStrings>
<clear />
<add name="SQL" connectionString="server=.\SQL2008;database=xxxxxx;uid=xxxxxx;pwd=xxxxxxxxxx;" providerName="System.Data.SqlClient" />
.....
</connectionStrings>
I am trying to get an application (that I didn't develop) running on a windows 2008 r2 64-bit server running IIS 7.5.
I am getting the above stated error - here are more details -
The requested page cannot be accessed because the related configuration data for the page is invalid
Error Code 0x8007007e
I know that the server can access the web.config, because if I make changes to it, the error code changes.
I also know that it is a correct web.config, because it is running successfully on a different server with the same file.
Does anyone have any idea what might be causing this. The error message I am getting really doesn't tell me anything.
I have tried using FailedRequestTracing, but either I don't know how to read those logs or there is no more information there. There are also no errors in the event logs on the server.
Where else can I look to get a better idea of what is happening?
Thanks for any thoughts....
EDIT - Here is the web.config. As I said earlier, it is strange that it is working on another server. I checked to ensure are referenced assemblies are available (as according to the page here, it appear that may be the problem) in the gac.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\temp\;deleteAfterServicing=false;" />
</appSettings>
<connectionStrings>
<!-- removed for this post -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<!--<add name="IBM Informix .NET Data Provider 3.0.0" invariant="IBM.Data.Informix.3.0.0" description="IBM Informix Data Provider 3.0.0 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.3.0.0, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>-->
</DbProviderFactories>
</system.data>
<system.web>
<httpRuntime maxRequestLength="8192" />
<customErrors mode="Off" />
<sessionState timeout="360" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear />
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="5000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
<tracing>
<traceFailedRequests>
<add path="*.aspx">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="400-600" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
It's a bit cheaty, but Microsoft has a page specifically about this problem ... and myriad suggestions for fixing it. Have you gone through it yet?
http://support.microsoft.com/kb/942055
Try this http://windowslivehelp.com/thread.aspx?threadid=3dd85141-a45d-44d9-a94c-3c7d13cfcd5c
I was able to get past this error by disabling compression that is applied by having wsus on the server.
See details here.
Thanks for everyone's help.
I enable error log filtering within Elmah and want to do it programmatically in a ErrorLog_Filtering event handler. It works well under Visual Studio dev server but as soon as I go under IIS7 (local on my dev machine or remote on my web server), the handler is not called (error logging works well).
Here is my usual web.config:
<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" />
<section name="errorTweet" requirePermission="false" type="Elmah.ErrorTweetSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ShopMvcConnectionString" />
</elmah>
<system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="Elmah.ErrorFilter" type="Elmah.ErrorFilterModule" preCondition="managedHandler" />
</modules>
<handlers>
<add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
and my handler in Global.asax:
public void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
}
The reason your handler in not being called under IIS 7 is because you named the module differently. You named it ErrorLog under system.web/httpModules and then Elmah.ErrorLog under system.webServer/modules.
Handling module events in Global.asax works via a naming convention where the event handler must be named after the module name as found in the configuration followed by an underscore (_), followed by the event name. ErrorLog_Filtering is fine and matches the registered name under system.web/httpModules and which is being picked up by the Visual Studio Development Server. You just need to make sure that you match up all the names and it should work in both environments.
See also: Programmatically log error and send email