Jason Bunting
Jason Bunting

Reputation: 58969

What is wrong with my MVC application?! (500 on Content and Scripts)

For anything under the Scripts or Content folders in my ASP.NET MVC application, I am getting the following error:

The page cannot be displayed because an internal server error has occurred

That's the response in its entirety (excepting the headers) - nothing else. I am hosting this on GoDaddy, and have not had problems with this application before. What did I do to screw this up?! Working on 4 hours of sleep isn't helping matters...

Upvotes: 1

Views: 2286

Answers (7)

Vibrant Ice
Vibrant Ice

Reputation: 81

I had the same issue when upgrading to a newer version of IIS, though with a different mime type. As you also surmised, I believe the new version must already have the type registered (or the host did it at the machine level). I solved it by putting "remove" before the "add" - all my content started showing up again. I would think this would prevent having to modify the config between dev and prod.

<staticContent>
    <remove fileExtensions=".mp4" />
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

This has been edited to replace video/mpeg with video/mp4. /mpeg still worked for me, but apparently mp4 is recommended.

Upvotes: 1

Jason Bunting
Jason Bunting

Reputation: 58969

This would be appropriate here:

"It takes considerable knowledge just to realize the extent of your own ignorance."

                                                  -Thomas Sowell

So, when struggling to get a Flash-based, JavaScript-configured component to work in my web app, I added a staticContent node to my web.config, with a mimeMap node as a child:

<configuration>
    ...
    <system.webServer>
        ...
        <staticContent>
            <mimeMap fileExtension=".mp4" mimeType="video/mpeg" />
        </staticContent>
    </system.webServer>
</configuration>

When I commented-out the entire staticContent node, everything worked just fine. I didn't know that adding a mimeMap here would cause all of the default mimeMaps (specified within the server's ApplicationHost.config) to be overridden, because that seems to be exactly what is going on...Then again, I am merely guessing - either way, not very easy to figure out.

Thank you to everyone that responded, I appreciate it!

Upvotes: 4

Martin
Martin

Reputation: 11041

Download Phil Haack's Route Debugger, then try navigating to one of the Scripts. You might be catching them in your routes.

Upvotes: 0

RailRhoad
RailRhoad

Reputation: 2128

Hmm, do you have any control of IIS on that hosting? Maybe they have a wildcard mapping interfering. That's happened to us before with site minder.

Upvotes: 0

Samantha Branham
Samantha Branham

Reputation: 7451

Perhaps you could try putting

routes.IgnoreRoute("Scripts");
routes.IgnoreRoute("Content");

in your route register?

Also make sure that if you are using the built-in authentication, you have this bit in your web.config, though I think it isn't your problem:

<location path="public">
    <system.web>
    <authorization>
        <allow users="*"/>
        </authorization>
    </system.web>
</location> 

Upvotes: 0

MarkKGreenway
MarkKGreenway

Reputation: 8774

Can you turn off Simple error messages?

Upvotes: 0

jrummell
jrummell

Reputation: 43117

In your web.config file, find the customErrors section and change mode to Off.

<customErrors mode="Off">
</customErrors>

Changing that will give you a more descriptive error.

Upvotes: 1

Related Questions