简体   繁体   中英

Failed to load resource: the server responded with a status of 500 (internal server error) for MVC ASP.NET

I have a project that is developed using ASP.NET MVC architecture and SQL as database. The UI consists of .cshtml, and .javascript (.js) files and .cs files for the business logic and I am using Visual Studio as the IDE. I am facing a strange error when I run the code on my laptop. However the same code when executed and deployed on server runs perfectly fine without any errors.

Following is the flow of program:

  1. Able to successfully login and connect to database (both locally and over the server)
  2. A dashboard should be displayed which should retrieve records from database along with charts and graphs.
  3. The Index.cstml file of the dashboard module calls a Dashboard controller which in turn calls few .cshtml files responsible for graphs, charts and records retrieval. These .cshtml files calls certain .js files which have methods for UI actions and related functionality.

The functionality works fine up to the point where dashboard controller is called with the dashboard page. There are no .js files as part of program flow till this point. The next call is as follows which calls the .cshtml file that is responsible for calling the .js files

return PartialView("_Request", rViewModel);

In this _Request.cshtml file there is path for the associated .js files which are not loaded.

<script src="/Scripts/Modules/Dashboard/request_methods.js?version=@DateTime.Now"></script>

<script src="/Scripts/Modules/Dashboard/request_events.js?version=@DateTime.Now"></script>

The dashboard hangs up without displaying any records or charts or graphs. I get the following errors when I right click on half loaded dashboard and say 'inspect' and then the following errors are displayed:

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

http://localhost:50337/Scripts/generic.request_lock.js?version=7/28/2016%206:01:48%20PM Failed to load resource: the server responded with a status of 500 (Internal Server Error)

http://localhost:50337/Scripts/Modules/Dashboard/reportswidgets_methods.js?version=7/28/2016%206:01:48%20PM Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The list continues for few more associated files .js files. A few more observations may help:

  1. The same project when built locally and deployed on server is executed with records and graphs displayed on dashboard page.
  2. All the .js files mentioned above and more are present at the location they are supposed to be locally.
  3. IIS not used locally since using development version over the visual studio and directly connects to database.
  4. The error occurs when connected to database both locally and over the server.
  5. The same is observed for both IE and Chrome.

I have not been a developer on ASP.NET MVC earlier and request to help me out with this in really simple terms.

The Config Error on network tab said - Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.less'.

I commented the below code that was present in web.config and got it to work perfectly fine.

Though don't know the technical reason behind it, but I am relieved as of now. Thanks for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM