MVC:请问favicon.ico的也找一个控制器? [英] mvc: does the favicon.ico also look for a controller?

查看:707
本文介绍了MVC:请问favicon.ico的也找一个控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个错误:

的路径/favicon.ico没有被发现,或者不执行一个IController控制器

"The controller for path '/favicon.ico' was not found or does not implement IController"

这时我想:如何框架知道哪些文件具有实例化一个控制器,因为同样的事情是脚本,CSS和其他文件真实

Then I thought: how does the framework know for which files it has to instantiate a controller, because the same thing is true for script, css and other files?

(从来没有想到这一点,但现在的图标是抱怨,我想知道......)

(never thought of that, but now the favicon is complaining, I was wondering....)

但是,回到错误,为什么会发生?

But back to the error, why does that occur?

推荐答案

这添加到您 Global.asax中

routes.IgnoreRoute("favicon.ico");

这篇关于MVC:请问favicon.ico的也找一个控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆