Вопрос

I'm working on an ASP.NET MVC 5 website hosted as an Azure website and I have included ELMAH for error logging. All seems to work fine except I find numerous errors like this one:

A public action method '...' was not found on controller ...

These errors appear mostly when the request comes from a spider bot but they don't seem to produce any errors in the response. Also, all logged controller/action names are totally valid.

E.g. when I run a tool like deadlinkchecker.com on my site, I find hundreds of errors in ELMAH while the tool produces a report with 100% valid links. The path info in ELMAH is also correct.

Why am I seeing these errors?

Это было полезно?

Решение

If you add Head as well as Get then this error will go away and the spider will read your site correctly. As Nathan said, you could turn them off, but you're not fixing the issue really, just ignoring it and you might lose out if spiders cannot read your site 100%

This should work, get fiddler out and try it!

[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Head)]
public ActionResult Test()
{
    return View();
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top