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?

2
  • Are you debugging by attaching to the worker process, or by pressing F5? Commented Aug 30, 2009 at 20:03
  • I am pressing F5, but as I have configured the project to use my local IIS7, what it really does is compile the code and attach itself to the process. I'll expand the question accordingly. Commented Aug 30, 2009 at 21:12

6 Answers 6

6

You need to make sure you are breaking on something that is actually server side!

You obviously won't be able to break on:

<h2>Title<h2>

And perhaps surprisingly, you can't break on:

@SomeCode here

But you can break on:

@{
SomeCodeHere
}
Sign up to request clarification or add additional context in comments.

Comments

0

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.

2 Comments

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.
Hmm.. Then, short of checking that everything is updated, I could only suggest having a look at the IIS.net article on it: learn.iis.net/page.aspx/387/….
0

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.

2 Comments

I'm already running it as an administrator, it wouldn't even open the project otherwise.
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).
0

I had the same issue then I installed ASP.NET 5 RC1 Update 1, things got worst.

I solved the problem deleting the ComponentModelCache folder out of the %appdatalocal%/Microsoft/VisualStudio/14.0 folder.

Comments

-1

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.

2 Comments

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.
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
-3

Enable line numbers for HTML here

Tool -> Options -> Text Editor -> HTML -> General

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.