0

I created a sample project for studying MVC 4 in Visual Studio 2012 (11.0.6... update 3) using the "Basic" template option.

There was the chapter about bundles configuration, so the author explained the usage of "F12 tools" in the browser for analyse the network traffic.

The project is basic, other than files created by VS template I just added a controller and a view, also a model class and launched the project. So, when analyzing the network in the F12 Tools I can see that all my files are loaded properly but the one "favicon.ico" there is 404 result...

When I look in the book I can't see that favicon.ico file loaded, so I ask myself from where could appear that problem?

The application works like expected, there is no functional problems but this one that I can be seen only in the network tab of the debugging tools...

Is this a Visual Studio "problem" or there is a "normal" behavior?
I supposed that in the Microsoft VS template should be a sample favicon set by default or should not exist at all, or maybe the book author just "removed" in a way that file from being loaded...

serge
  • 13,940
  • 35
  • 121
  • 205
  • This has nothing to do with MVC. Your browser just looks for a favicon but doesn't find any. – user247702 Oct 08 '13 at 08:36
  • this has to do with the default MVC 4 template (Basic) in Visual Studio... – serge Oct 08 '13 at 08:42
  • Browse to *http://localhost/* to load the default IIS page and check the network tab. You'll see the same behaviour: IE looks for a favicon but gets a 404 response because there is none. – user247702 Oct 08 '13 at 08:46
  • Here a detailed question about the favicon on SO; "Serving favicon.ico in ASP.NET MVC": http://stackoverflow.com/questions/487230/serving-favicon-ico-in-asp-net-mvc – florian.isopp Oct 08 '13 at 08:48
  • @FlorianIsopp I just try to understand if Microsoft didn't include on purpose the icon or is a "forgot" from their part – serge Oct 08 '13 at 08:51
  • ok, try to maintain the question, also the question sentence itself to point more clearer to matter of interest! – florian.isopp Oct 08 '13 at 08:54

3 Answers3

1

For those with more advanced scenarios. If the site has a login page, there is a possibility that the login page has the Layout set to null.

In this case, it is necessary to add another link of the favicon to the independent header of the login page/view

@{
Layout = null;
 }

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" type="image/ico" href="~/favicon.ico">
</head>
usefulBee
  • 9,250
  • 10
  • 51
  • 89
0

Does "favicon.ico" exist in your project?

If not you can create your own one and place it in the project and make sure it's referenced properly.

Hope this helps.

Given
  • 166
  • 4
  • 1
    I use a default MVC4 template in Visual Studio. So I didn't specify any favicon.ico, but I belive this should be included in the template, or Microsoft forgot to setup that file in their template – serge Oct 08 '13 at 08:44
  • @Serge So you're just complaining that the default template does not include a favicon? – user247702 Oct 08 '13 at 08:45
  • the book I study does not have this "404" in its printScreen, this why I am wondering if is not my fault? – serge Oct 08 '13 at 08:57
  • 1
    Not your fault, could be that Microsoft forgot it in the template, it's not a train smash, just create your own favicon and problem solved. – Given Oct 08 '13 at 08:59
  • I don't try to solve the problem... I try to understand how/why/is it OK that it happened... – serge Oct 08 '13 at 10:22
0

I got this running VSC. I had installed Node.js, too. My code had no reference to favicon.ico, so something I loaded was trying to load it. VSC was looking for favicon.ico in the local web server path where my VSC modules were. I searched my entire PC and found a bunch of facicon.ico entities. One of them was in the Node.js installation. So I simply copied it to my web server path. The "failed to load" error in VSC went away, but I remain unconvinced that I solved the problem.

I hate that, but things are too complicated to explain everything. I'll just hope not to have another error.

Micky Lee
  • 1
  • 3