Failed to load all resources - error 500

2019-06-15 01:31发布

问题:

I have a problem where i get this error in the developer console, for all css, image and js files:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The file name and path looks fine and it's happening for ALL resources. The project is an ASP.NET MVC project, which my co-worker can build and run just fine, without these errors. The project is located in my usual projects folder and i have never experienced this problem before. I also checked the folder permissions, and i am completely clueless as to why this is happening.

The resources are bundled, but if i create the links to the resources manually, it throws the same errors in the developer console.

Have anyone ever tried something like this before?

Log: Log

Tracelog: Tracelog

BundleConfig.cs

public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/jquery.min.js",
                        "~/Scripts/jquery.simplemodal.js",
                        "~/Scripts/jquery.flot.min.js",
                        "~/Scripts/jquery.flot.categories.min.js"
                        ));

            bundles.Add(new ScriptBundle("~/bundles/language").Include(
                "~/Language/english.js",
                "~/Language/spanish.js",
                "~/Language/french.js"
               ));


            bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Styles/StyleNuheat.css",
                "~/Styles/buttons.css",
                "~/Styles/energy.css",
                "~/Styles/modalwindow.css",
                "~/Styles/dropdown.css",
                "~/Styles/jquery-ui.css"
                ));

            bundles.Add(new ScriptBundle("~/bundles/thermostat").Include(
                "~/Scripts/appl_thermostats.js",
                "~/Scripts/appl_thermostat_details.js",
                "~/Scripts/appl_schedule.js"
                ));

            bundles.Add(new ScriptBundle("~/bundles/general").Include(
                "~/Scripts/appl_supporter.js",
                "~/Scripts/appl_master.js",
                "~/Scripts/appl_navigation.js",
                 "~/Scripts/appl_general.js"
                ));

            bundles.Add(new ScriptBundle("~/bundles/energy").Include(
                "~/Scripts/appl_energy.js", 
                "~/Scripts/jquery-ui.js"

                ));

            bundles.Add(new ScriptBundle("~/bundles/useraccount").Include(
                "~/Scripts/appl_useraccount.js"
                ));
            bundles.Add(new ScriptBundle("~/bundles/groups").Include(
                "~/Scripts/appl_groups.js"
                ));
            bundles.Add(new ScriptBundle("~/bundles/login").Include(
                "~/Scripts/appl_login.js"
                ));


        }
    }

回答1:

According to the TraceLog file that you provided you have a problem in your web.config file. An exception message is C:\Users\teilmann\source\Nuheat\oj.web\oj.web.main\web.config ( 112) :Cannot add duplicate collection entry of type "mimeMap" with unique key attribute "fileExtension" set to ".json"

Most likely you have a MIME type defined for JSON files both on the WebSite and application level



回答2:

I am working on Win2012 server and using IIS 8.5 .

Please check "staticcontent" section in web config. There is a line in our config for mimemap and mimetype .

mimeMap fileExtension=".woff" mimeType="application/x-woff"

I commented this line and it started working. 500 error got resolved for me.



回答3:

I fixed it by removing the content of the staticContent in my web.config. IIS 10 was complaining about having duplicate fileExtentions keys in web.cofing.



回答4:

Most likely it's beacuse of permission, Make sure that your folder has a right permission for IIS_IUSRS account.



回答5:

If the css is not loaded, use the developer tool in the Chrome to see the css name. Navigate to that css in the browser- If the custom error mode is turned off, it will show the actual error. In my case, duplicate mimetype was present.