6

I'm using Visual Studio 2013 with IIS Express 8 to develop an application for a local Intranet. This application was built using ASP.NET MVC 4 in Visual Studio 2012 and later migrated to 2013. I had been using Visual Studio Development Server until I migrated to VS2013 with no issues.

After the migration, the application compiles, runs and authenticates fine, but it's not serving Static Files - it just returns an HTTP 500 response with no further details. See image below:

IIS Express not serving static files

This also happens to Images and CSS files.

What can I check to solve this? Any suggestions?

UPDATE:

  • The application works fine in Local IIS (version 8).
  • It works in IIS Express on other PCs.

UPDATE 2:

  • After further testing, I found out that this only happens to Mozilla Firefox (it works fine in Internet Explorer and Google Chrome) - I didn't notice before because I always use FF. Currently using version 29.

Any ideas?

Meryovi
  • 6,121
  • 5
  • 42
  • 65

4 Answers4

13

Finally! I was able to solve this issue with the help of this question.

This was happening because Firefox by default has Windows Integrated Authentication turned off. It doesn't make any sense to me why it works fine in regular IIS or in dynamic files (controller actions, WebApi, etc.), but that's a mystery for another day.

To enable Windows Integrated Authentication I followed this steps:

  • Type about:config in Firefox's address bar (nav bar)
  • Search for network.automatic-ntlm-auth.trusted-uris
  • Double click on network.automatic-ntlm-auth.trusted-uris
  • Add http://localhost to the list (paste that if it's empty)

After that I just hit F5 in Firefox and everything worked as expected.

This issue is poorly documented, so I wonder if nobody else uses Firefox with MVC to develop web applications using Windows Integrated Authentication?

Community
  • 1
  • 1
Meryovi
  • 6,121
  • 5
  • 42
  • 65
  • Ah, "Navigate to" means type about:config in Firefox browser navbar (address bar). Okay, firefox is like a secret code decryptor. After these steps I had to blow on a whistle that sounded a perfect A 440Hz and then I had to type 6 unprintable chars. :) Finally got there. – raddevus Jul 29 '15 at 19:33
  • Once again this bites me, and then this answer saves the day. – mxmissile Dec 14 '18 at 00:49
3

Have you had a look at this ?

ASP.NET MVC application gives Internal Server Error only when viewed in Firefox

It doesn't explain why it works on IIS but there is a firefox doesn't support Integration Authentication out of the box.

Community
  • 1
  • 1
Hamid Shahid
  • 4,486
  • 3
  • 32
  • 41
0

The only thing that seems applicable to your situation is a problem with the install of IIS Express since this is an similar issue to something seen in previous IIS Express versions. I would either re-install it or see if your version of Windows can host IIS 8 in which you would just enable static content.

If this was just a matter of not having static content turned on or permissions for static content, you'd get a 404 or 401 error respectively. Hope this helps...

gfish3000
  • 1,557
  • 1
  • 11
  • 22
  • @Meryovi, in this case I would try to see if you can use full blown IIS and see if you can serve static content. If you can't, I'm not sure what to tell you without actually seeing your computer to look for clues. Sorry, no easy answer seems to be out there for your issue if there's no change after a re-install. – gfish3000 Apr 24 '14 at 17:42
  • It works fine in regular IIS, I just don't know how to fix it in IIS Express or where to look. Thanks for all the help. – Meryovi Apr 24 '14 at 17:48
0

I'd look in the machine events viewer under application and system to see what the issue is. Does the IIS serve anything up in the same folder such as .txt files, .html, jpg images?

It could possible be file or folder permission and/or the anonymous user being used to access them under IIS.

My first point would be event viewer though for more detailed information on the 500 error.

SkyBlues87
  • 1,196
  • 9
  • 17
  • It doesn't serve any static file that has an extension (it does serve razor pages and MVC action results that are extension-less HTML pages). I don't see any error messages in the Event-Viewer. – Meryovi Apr 25 '14 at 12:59
  • have you changed the routing in MVC? – SkyBlues87 Apr 25 '14 at 13:06
  • Can you post a screen shot of the projects web settings? – SkyBlues87 Apr 25 '14 at 13:07
  • Yes, I'm using AttributeRouting. But if I create a new project with the default settings, the same thing happens. – Meryovi Apr 25 '14 at 13:09
  • Interesting. What changes did you make to IIS Express as per the description? – SkyBlues87 Apr 25 '14 at 13:14
  • I just noticed this only happens in Firefox. The changes I made back then to enable Win-Auth are no longer relevant, since I restored the original config later. – Meryovi Apr 25 '14 at 18:37