Comments (6)
These are the errors that YOUR site has raised that were caught by ElmahCore. If your site doesn't have a favicon.ico browsers automatically try to load one when they go to a domain. which will raise a 404 error.
Do you really want to log all 404 errors?
I think a lot of us filter out 400 errors something like:
public class CmsErrorLogFilter : IErrorFilter
{
public void OnErrorModuleFiltering(object sender, ExceptionFilterEventArgs args)
{
if (args.Exception.GetBaseException() is FileNotFoundException)
args.Dismiss();
if (args.Context is HttpContext httpContext)
{
if (httpContext.Response.StatusCode == 404)
args.Dismiss();
if (httpContext.Response.StatusCode == 400)
args.Dismiss();
}
}
}
from elmahcore.
@afastrunner - thank you, I did not say ElmahCore was the issue, but trying to understand. I don't maintain the source code for the route .../elmah/errors. The is a generated route from the ASPNET Core config. It appears that the /elmah/errors route is attempting to reference favicon.ico from its generated Elmah log error user interface that is shown the original posting. Can you explain how or where the ElmahCore admin interface is generated from?
from elmahcore.
when your browser goes to localhost:7065/elmah/errors the browser says to it's self "lets see if this domain localhost has a favicon.ico I can display in the browser tab and requests it from /favicon.ico" the /favicon.ico request starts with / so it's made to the root application localhost:7065/favicon.ico which is your application, the static file middleware there says "nope I don't have favicon.ico and raises a 404 exception" elmah middleware sees the 404 exception and logs it's in the interface your seeing.
Adding a favicon.ico in the elmah/errors location wouldn't prevent this.
So it goes back to to what you want to do, ether have 404 error messages logged or not. OR add a favicon.ico to the /wwwroot folder in your application to prevent this one 404 error OR I guess if you really wanted to you could add a middleware that look for requests to /favicon.ico and returns 200 (but that would be odd)
from elmahcore.
@afastrunner - thank you for your time to explain. And that it my understanding of what is going on too, but the confusion comes from the fact that dropping a favicon on the root of localhost:7065 had no affect when I tried before submitting this issue to GitHub. Plus I never realized that a browser always tries request a favicon.ico even if there isn't page containing meta data link/referencing one. Surprised I've never ran into that.
You mention a wwwroot folder, but my root are just libraries and does not have wwwroot. I guess I give that a try
from elmahcore.
Yeah if it's WebAPI you likely don't have Static files Middleware enabled so putting favicon.ico in your root doesn't serve anything. If it was a MVC/Razor you would have a wwwroot folder and static files middleware serving files from that folder.
Best bet is just ignore that error or specifically filter it out in IErrorFilter
from elmahcore.
Many thanks for taking the time to help assist with this. Much appreciated!
from elmahcore.
Related Issues (20)
- is publish package available
- Elmah Generates Error Request did not match any endpoints
- ElmahCore.Mvc.ErrorWrapper IsMobile method requires length check
- UI - Scrollbar not showing until window resize
- Possible to disable connections to ip-api.com? HOT 1
- Out Of Memory Exception
- The log file path can't change to my desired path HOT 1
- Secure error page without authentication? HOT 1
- 2.2 Version Available in the NuGet Package? HOT 3
- Remove Sensitive Information HOT 4
- UI not coming up with React SPA
- How to remove Source tab in the ElmahCore Dashboard
- Remove SqlLogs from AllXml?
- Notifiers (and probably Filters as well) should be registered through Dependency Injection HOT 1
- Very slow ErrorDetailHelper.MarkupStackTrace call with text from in a docker container.
- Repo & project link wrong way around
- Set license expression on nuget packages
- Optimise dependencies by using frameworks
- 2.2.0 Search And Filters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elmahcore.