简体   繁体   English

WebStorm ASP.NET MVC JavaScript调试

[英]WebStorm ASP.NET MVC JavaScript Debugging

Does anyone know how to use WebStorm for JavaScript debugging of an ASP.NET MVC application? 有谁知道如何使用WebStorm进行ASP.NET MVC应用程序的JavaScript调试? I am running my ASP.NET MVC application locally using IIS, and I am trying to use WebStorm's remote debugging features to step into JavaScript code. 我在本地使用IIS运行我的ASP.NET MVC应用程序,我正在尝试使用WebStorm的远程调试功能来进入JavaScript代码。 My understanding so far is that you can map local files to the hosted ones, but I'm not sure how to do this since my local files are razor views and don't map 1-to-1 to the HTML that is served via IIS. 到目前为止,我的理解是您可以将本地文件映射到托管文件,但我不知道如何执行此操作,因为我的本地文件是剃刀视图,并且不会将1对1映射到通过服务提供的HTML IIS。 Any suggestions on how to set this up, or resources on how to do so, would be greatly appreciated. 关于如何设置它的任何建议,或者有关如何设置的资源,将不胜感激。

I just found your question searching for answers to a different question. 我刚刚找到你的问题,寻找不同问题的答案。

I am running a web application using ASP.NET MVC 5 and several C# libraries supporting it. 我正在运行一个使用ASP.NET MVC 5和几个支持它的C#库的Web应用程序。 We use AngularJS and I spend 90% of my time developing in JS on this project. 我们使用AngularJS,我花了90%的时间在JS上开发这个项目。 I just downloaded WebStorm 7 as a trial and I created a new project that points to the directory that contains all of my ASP.NET MVC HTML/JS files (it's my entire ASP.NET web project, which excludes my C# libraries, etc.). 我刚刚下载了WebStorm 7作为试用版,我创建了一个新项目,指向包含所有ASP.NET MVC HTML / JS文件的目录(这是我的整个ASP.NET Web项目,它排除了我的C#库等。 )。 I am able to set debug breakpoints in WebStorm on my JS files, and it all works well - super easy. 我可以在我的JS文件中在WebStorm中设置调试断点,这一切都运行良好 - 超级简单。 This is one option for debugging your ASP.NET app via WebStorm. 这是通过WebStorm调试ASP.NET应用程序的一个选项。

The alternative is to use your browser's dev tools, then make changes to your JS files in VS. 另一种方法是使用浏览器的开发工具,然后在VS中更改JS文件。 Otherwise, getting debugging to work in WebStorm was fast and easy. 否则,在WebStorm中进行调试是快速而简单的。

It has been 1.5 years since you posted this question, so you have moved on I am sure, but for anyone else reading this - hope that helps. 你发布这个问题已经有1。5年了,所以你已经开始了我确定,但对于其他读这篇文章的人 - 希望有所帮助。

Debugging JavaScript is the same no matter the backend: 无论后端调试JavaScript都是一样的:

  • setup a minified/unminified toggle via a cookie or query param 通过cookie或查询参数设置缩小/未缩小的切换
  • check the console for errors in the unminified code 检查控制台是否有未经授权的代码中的错误
  • set up breakpoints to see what is causing the error 设置断点以查看导致错误的原因
  • use the browser developer tool to test possible solutions 使用浏览器开发工具来测试可能的解决方案

There are also remote debugging IIS instructions as well as cross-domain JavaScript setup information. 还有远程调试IIS指令以及跨域JavaScript设置信息。

References 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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