可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
IE8 is out and apparently it automatically turns on script (JavaScript) debugging whenever you launch your project in debugging mode. Does anyone know how to turn this ofF? I scoured the IE8/VS2008 settings but didn't see anything.
Edit: You can't just go into Internet Options and disable debugging: http://blogs.msdn.com/webdevtools/archive/2008/03/05/jscript-debugging-made-easy-with-ie8.aspx This is so you can leave debugging off for regular web browsing, but have it automatically come on when debugging. I want script debugging off for good.
THE REAL ANSWER: Even though someone already won the bounty, they didn't really answer the question. I went straight to the source (Microsoft) and ended up getting a blog post with some workarounds here. Sweet!
回答1:
It's annoying, but you can do this per session:
- Start debugging your website, F5
- In the top menu, go to Debug;Windows;Processes
- In my Processes window, there are two processes, one for IExplore:script and one for WebDev.WebServer.EXE:Managed. Right-click the IExplore:script lineitem and select Detach Process.
UPDATE
The link that Nicholas provided explains that installing the Silverlight SDK and then enabling Silverlight debugging for your web project (a checkbox on the bottom of the "Web" tab in the property pages) will prevent the script debugger from attaching to the IE process. Basically, you can't debug both at the same time, and the Silverlight option takes precedence. The link also provides several registry tweaks to partially or fully disable script debugging.
I started using the Silverlight workaround technique after I posted this answer, so I was coming back to update it when I saw that the OP found the same solution. Since this answer was accepted and awarded a bounty but didn't really answer the question, I hope this update gives the answer a tiny bit more merit.
回答2:
When I detach the the iexplore.exe process as described in the "per session" solution above it also detaches the aspnet_wp.exe process and dumps me out of debug.
The Options | Advanced | Disable Script Debugging" also does not work. Here's why: http://blogs.msdn.com/webdevtools/archive/2008/03/05/jscript-debugging-made-easy-with-ie8.aspx
Apparently VS2008 turns it on for you, regardless of the Advanced setting in IE8.
The only work around I have found for this is to start the IE8 session first (such as with "View in Browser" from the Solution Explorer) and then choose Debug | Attach to Process in VS2008 and attach to the aspnet_wp.exe process.
回答3:
Here is a solution that allows you to debug asp.net code normaly but disable javascript.
Set the two registry values:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN]
"TabProcGrowth"=dword:00000001
If you use a x64 windows you must set also this
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN]
"TabProcGrowth"=dword:00000001
Solution found at:
http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/e179672e-5a33-41ec-abc6-08c0b429af61
回答4:
Simple workaround :
Change the default browser in your Visual Studio Project
(By using 'Browes with....' change default)
to Google Chrome for exqample.
Than when you click F5 it will open google Chrome.
Manually open your Interent Exploerer and navigate to the page you want to debug.
回答5:
Have you tried this, in IE8, Open Internet Options > Advanced > Select "Disable Script Debugging" for both Internet Explorer and Other?
回答6:
Have you tried using IIS for debugging rather than the built-in web server (Cassini)?
I mostly use IIS for debugging and have not noticed this behavior with IE 8.
Might not be the most ideal solution, but it sure beats the heck out of having to manually attach/detach to the process every time.
回答7:
As Jimmie R Houts suggested, use IIS rather than Cassini for a start.
How about a slightly different workflow on top of that, rather than hitting F5 all the time you can use Attach/Detach to control what VS will debug.
- Build your solution
- Start up your web browser of choice.
- Navigate to the page your using.
- In visual studio: Debug -> Attach to Process...
- Select aspnet_wp.exe or w3wp.exe depending on your OS/version of IIS.
- Select what you want to debug (Managed code/Sql)
- Do whatever you want to debug on your page.
- When you need to make a code change, dettach the debugger (press stop) - note your browser of choice doesn't close.
- Make your code change, rebuild the solution, reattach the debugger and continue using your browser of choice.
I find this handy, because if you've got to do a couple of steps before you get to the area that you're debugging - with this method you don't need to redo all the steps. Certainly bits hitting F5 all the time :)
If you want to debug JS in Visual Studio, you attach to iexplore process and debug script.
回答8:
Set the "Start Action" of your project to "Start External Program" then select the IE8 executable and as command line argument give the url of your project.
When you start the project with F5 the javascript debugging will be disabled.