7
Reply

Failed to load resource: the server responded with a status

Ask a question
Alok

Alok

8y
435
1

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/[email protected]"></script>

<script src="/Scripts/Modules/Dashboard/[email protected]"></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)

http://localhost:50337/Scripts/Modules/Dashboard/reportswidgets_events.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. Thanks in advance.


Answers (7)