简体   繁体   English

如何在 WebStorm 中调试 .NET 嵌入式 js 文件?

[英]How to debug .NET embedded js-files in WebStorm?

I'm wondered is it possible to debug .net embedded js files in WebStorm?我想知道是否可以在 WebStorm 中调试 .net 嵌入式 js 文件? Because, actually, breakpoints in the real file doesn't work.因为,实际上,真实文件中的断点不起作用。 And .NET WebApplication sends it's own (zipped) content with no references to original file. .NET WebApplication 发送它自己的(压缩的)内容,不引用原始文件。

How I can debug js in that case, using WebStorm debugger ?在这种情况下,如何使用WebStorm 调试器调试js

UPDATE (for better understanding of the problem).更新(为了更好地理解问题)。 So I have file called, for example, dialog.js .因此,我有一个名为dialog.js的文件。 I set the property "Embedded" for this file in .net project config.我在 .net 项目配置中为此文件设置了“嵌入式”属性。 I've added assembly declaration for this file.我为此文件添加了程序集声明。 So it behaves like .net assembly.所以它的行为类似于 .net 程序集。 Then I added that assembly with ScriptManager to queue, loaded on a client startup.然后我将该程序集与 ScriptManager 添加到队列中,在客户端启动时加载。 And in that stage - this file is loaded with the url like *http://site/ScriptResource.axd?d=AC9roCTnD0FDFmh4thoy3kzImrN7wKp9_WVOFcPes0Zzhg1&t=2aaf8bd5/eval/seq/70*.在那个阶段 - 这个文件加载了 url 像 *http://site/ScriptResource.axd?d=AC9roCTnD0FDFmh4thoy3kzImrN7wKp9_WVOFcPes0Zzhg1&t=2aaf8bd5/eval/seq/70*。 And I'm not able to debug this file with WebStorm - it reasonably says that cannot connect to the file dialog.js .而且我无法使用 WebStorm 调试此文件 - 它合理地说无法连接到文件dialog.js Maybe I need to specify/change the naming rules (or rewrite url) of the url for my embedded files?也许我需要为我的嵌入文件指定/更改 url 的命名规则(或重写 url)?

Use a browser debugger and debug client-side.使用浏览器调试器并调试客户端。 Chrome and IE9 come with a good one one built-in, and Firefox has a decent one available as a plugin. Chrome 和 IE9 内置了一个不错的选项,Firefox 有一个不错的插件。

Yes.是的。 I'm pretty experienced with Firebug... But when I met WebStorm IDE, I felt in love.我对 Firebug 非常有经验……但是当我遇到 WebStorm IDE 时,我感觉自己恋爱了。 So I want to use JetBrains' debugger, not built-in one.所以我想使用 JetBrains 的调试器,而不是内置的。 Also I have experience with GWT technology and JetBrains' debugger was very cool (much more better then others).我也有使用 GWT 技术的经验,JetBrains 的调试器非常酷(比其他的要好得多)。 So my intention is to use WebStorm to debug javascript.所以我的意图是使用WebStorm来调试javascript。 – ajukraine – 阿朱克林

Ok, granted I don't use WebStorm, but from a glance at its abilities it looks like the WebStorm JS debugger is really for pure HTML/JS programs, not server-side code.好吧,当然我不使用 WebStorm,但从它的功能看,WebStorm JS 调试器看起来真的是用于纯 HTML/JS 程序,而不是服务器端代码。 That said, there's this little feature that allows you to debug applications directly in Firefox.也就是说, 这个小功能允许您直接在 Firefox 中调试应用程序。 The example points toward a file, but I would be surprised if it didn't accept a URL as well.该示例指向一个文件,但如果它也不接受 URL,我会感到惊讶。 Try pointing that toward your server-side .NET application, and you should be able to debug the JS file in question.尝试将其指向您的服务器端 .NET 应用程序,您应该能够调试有问题的 JS 文件。

I figured it out, you don't need to worry about what the underlying web server is (apache, iis, whatever), and you can even debug remote http urls.我想通了,你不必担心底层的 web 服务器是什么(apache、iis 等等),你甚至可以调试远程 http url。 All you do is setup the debug config in webstorm to point to the url you are testing for the "path" attribute in the edit configuration.您所做的就是在 webstorm 中设置调试配置以指向 url 您正在测试编辑配置中的“路径”属性。

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

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