简体   繁体   English

使用谷歌浏览器调试网站

[英]Debugging Websites with Google Chrome

When writing an ASP.NET website, Visual Studio allows me to specify which browser to use for debugging.在编写 ASP.NET 网站时,Visual Studio 允许我指定使用哪个浏览器进行调试。 I've just started playing with MVC 3 and I'm not seeing any such option.我刚刚开始使用 MVC 3,但没有看到任何这样的选项。

With MVC, debugging occurs in Google Chrome, which is fine except that Visual Studio doesn't recognize when I've closed the browser.使用 MVC,在 Google Chrome 中进行调试,这很好,只是 Visual Studio 在我关闭浏览器时无法识别。 I must then manually shut down the debugger.然后我必须手动关闭调试器。

Is there a way to either A) have the Visual Studio debugger recognize when I've stopped debugging the website in Chrome, or B) specify that IE should be used when debugging?有没有办法 A) 当我停止在 Chrome 中调试网站时让 Visual Studio 调试器识别,或者 B) 指定在调试时应该使用 IE? (I prefer to keep Chrome as my default browser when browsing the Web.) (在浏览 Web 时,我更喜欢将 Chrome 作为我的默认浏览器。)

I believe this extension allows you to choose your browser with MVC applications.我相信这个扩展允许您选择带有 MVC 应用程序的浏览器。 Or, you could just add a normal HTML page, and set the browser default on that.或者,您可以添加一个普通的 HTML 页面,并在其上设置浏览器默认值。 This should become the default for the rest of your project.这应该成为您项目的 rest 的默认设置。

When you debug a web application, Visual Studio simply attaches itself to the IIS process (or the development server process, if you're using that), and starts the browser with the correct URL.当您调试 web 应用程序时,Visual Studio 只是将自身附加到 IIS 进程(或开发服务器进程,如果您正在使用它),并使用正确的 ZE6B391A8D2C4D459702A23A8B6DZ 启动浏览器。 The browser doesn't even know you're debugging.浏览器甚至不知道您正在调试。 With IE, Visual Studio performs some additional inter-process voodoo to detect when IE closes;使用 IE,Visual Studio 会执行一些额外的进程间 voodoo 来检测 IE 何时关闭; other browsers however are unaware of this mechanism and simply do what they always do - display the page until the user closes it.然而,其他浏览器不知道这种机制,只是做他们一直在做的事情——显示页面直到用户关闭它。 So your choices are:所以你的选择是:

  • Live with the fact that you'll have to close the browser manually忍受您必须手动关闭浏览器的事实
  • Reuse browser windows (instead of running the browser from inside Visual Studio, use "Attach to process" and open the page manually)重用浏览器 windows(而不是从 Visual Studio 内部运行浏览器,使用“附加到进程”并手动打开页面)
  • Bite the bullet and use IE咬紧牙关使用IE

To keep IE as you browser right click on an aspx file and click browse with.要将 IE 保留为浏览器,请右键单击 aspx 文件,然后单击浏览方式。 you should be able to set a default from there.您应该可以从那里设置默认值。

If you don't have an aspx form just create one, set pref then delete.如果您没有 aspx 表单,只需创建一个,设置 pref 然后删除。

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

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