views:

746

answers:

3

I'm forced to use IIS7 because Casini is only x86 and we are running with x64 ELMAH.

Something I've noticed since I've switched is that I cannot set breakpoints in ASP.NET MVC views anymore. I'm not totally sure it's because of IIS7, is it? Does it happen to you as well?

The Visual Studio (2008) project is configured to use the local IIS7. I normally run the project by pressing F5, which actually doesn't run anything. It compiles the code and attaches itself to the corresponding IIS7 process.

The limitation of breakpoints is very hard into my environment now. If I right click a piece of code in a view there's a "Breakpoint" sub-menu, like before, with the Insert Breakpoint. But when I try to insert a breakpoint I get a blue message at the bottom of Visual Studio saying:

This is not a valid location for a breakpoint.

and no breakpoint is set. Setting breakpoints in the compiled code, like the controller presents no problem.

Is there any way to solve put a breakpoint in the view?

A: 

You can try attaching the process (Ctrl+Alt+P) to w3wp.exe and running it from there. If there are more than one w3wp.exe process running, consider using the tips from InfoPath MSDN blog.

That said, being "forced to use IIS7" over Cassini is like being forced to choose ice cream over raw sewage.

Dan Atkinson
Attaching by Ctrl+Alt+P doesn't make any difference to attaching by pressing F5 regarding to breackpoint setting. I prefer sewage with breackpoints to icecream with painful debugging.
J. Pablo Fernández
Hmm.. Then, short of checking that everything is updated, I could only suggest having a look at the IIS.net article on it: http://learn.iis.net/page.aspx/387/using-visual-studio-2008-with-iis-70/.
Dan Atkinson
A: 

Try running VS as the administrator, I ran into this problem trying to attach to the IIS7 w3wp.exe. I started mine as admin and has worked just fine.

Kyle LeNeau
I'm already running it as an administrator, it wouldn't even open the project otherwise.
J. Pablo Fernández
An elevated admin?
flipdoubt
Which version of windows are you running? If you are running Windows 7 or some variant of vista you can right click on your shortcut to VS 2008 and say run as administrator (assuming your user account has administrative privileges). Then just open your project from there and attach tot he worker process (the w3wp.exe is most likely running as administrator).
Kyle LeNeau
A: 

Can you set break points anywhere else in your code?

I've never personally set a break point in one of my views, have you tried setting the break point in the controller on the line which returns the view and then tried stepping into the view from there?

What are your trying to debug in your view? It should be kept clean and simple with no logic. That is why I've never needed to debug one.

theouteredge
Yes, I can set up a break points anywhere else and I can set up break points in views when using Casini. Not sure if I can set up the break point before and the step into the view, I don't think so.
J. Pablo Fernández
I've managed to set the break in and action and it then steps through into the view. You still having a problem with this? If so, I'll try with IIS tonight
theouteredge