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.
我有一个使用ASP.NET MVC架构和SQL作为数据库开发的项目。 UI由.cshtml和.javascript(.js)文件以及业务逻辑的.cs文件组成,我使用Visual Studio作为IDE。当我在笔记本电脑上运行代码时,我遇到了一个奇怪的错误。但是,在服务器上执行和部署时,相同的代码运行完全没有任何错误。
Following is the flow of program:
以下是程序流程:
- Able to successfully login and connect to database (both locally and over the server)
- A dashboard should be displayed which should retrieve records from database along with charts and graphs.
- 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.
能够成功登录并连接到数据库(本地和服务器)
应显示一个仪表板,该仪表板应从数据库中检索记录以及图表和图形。
仪表板模块的Index.cstml文件调用Dashboard控制器,该控制器又调用几个负责图形,图表和记录检索的.cshtml文件。这些.cshtml文件调用某些.js文件,这些文件具有UI操作和相关功能的方法。
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
该功能可以正常工作,直到仪表板控制器被仪表板页面调用。到目前为止,没有.js文件作为程序流程的一部分。下一个调用如下,调用负责调用.js文件的.cshtml文件
return PartialView("_Request", rViewModel);
In this _Request.cshtml
file there is path for the associated .js files which are not loaded.
在此_Request.cshtml文件中,存在未加载的关联.js文件的路径。
<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)
无法加载资源:服务器响应状态为500(内部服务器错误)
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:
该列表继续用于更多关联文件.js文件。还有一些观察可能会有所帮助:
- The same project when built locally and deployed on server is executed with records and graphs displayed on dashboard page.
- All the .js files mentioned above and more are present at the location they are supposed to be locally.
- IIS not used locally since using development version over the visual studio and directly connects to database.
- The error occurs when connected to database both locally and over the server.
- The same is observed for both IE and Chrome.
在本地构建并部署在服务器上的同一项目将使用仪表板页面上显示的记录和图形执行。
上面提到的所有.js文件都存在于它们应该在本地的位置。
由于在Visual Studio上使用开发版本并直接连接到数据库,因此本地未使用IIS。
在本地和服务器上连接到数据库时发生错误。
IE和Chrome都观察到相同的情况。
I have not been a developer on ASP.NET MVC earlier and request to help me out with this in really simple terms.
我之前没有成为ASP.NET MVC的开发人员,并且要求以非常简单的方式帮助我解决这个问题。
1 个解决方案
#1
0
The Config Error on network tab said - Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.less'.
网络选项卡上的配置错误说 - 无法添加“mimeMap”类型的重复集合条目,并将唯一键属性“fileExtension”设置为“.less”。
I commented the below code that was present in web.config and got it to work perfectly fine.
我评论了下面的代码,它存在于web.config中并使其工作得非常好。
Though don't know the technical reason behind it, but I am relieved as of now. Thanks for the help.
虽然不知道它背后的技术原因,但我现在感到宽慰。谢谢您的帮助。
#1
0
The Config Error on network tab said - Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.less'.
网络选项卡上的配置错误说 - 无法添加“mimeMap”类型的重复集合条目,并将唯一键属性“fileExtension”设置为“.less”。
I commented the below code that was present in web.config and got it to work perfectly fine.
我评论了下面的代码,它存在于web.config中并使其工作得非常好。
Though don't know the technical reason behind it, but I am relieved as of now. Thanks for the help.
虽然不知道它背后的技术原因,但我现在感到宽慰。谢谢您的帮助。