Monday, October 29, 2012

IIS, Visual Studio and Razor

I'm working on my second project that uses MVC and Razor. While working on the first one, I noticed that any time I tried to paste something into a .cshtml file, Visual Studio hung for what seemed like an eternity (although it was probably 10-20 seconds). It was so annoying that I edited those files in a text editor and never opened them in Visual Studio.

I didn't notice this problem in my current project, until today. Not only that, but suddenly every time I tried to set a breakpoint in a .cshtml file, Visual Studio would freeze and I would end up killing it with task manager. Everything worked fine until today, and I was pretty pissed when it quit working. I restarted Visual Studio multiple times, I rebooted my computer, I changed my code back to how it was at the beginning of the day, all to no avail.

But then I remembered that earlier today I had changed the ASP.NET Impersonation setting for my application in IIS because I needed it to impersonate a specific user. On a whim, I changed that back to the default (Authenticated user). And guess what? Now Visual Studio plays nicely with my .cshtml files.

Then, on another whim, I changed my specific user to an Administrator account and tried it again, and it still works.

So the moral of the story is to use an Administrator account (on the development machine) if you need to have IIS impersonate a specific user. I guess I can kind of see how using a regular account might mess with the breakpoints, but cutting and pasting? Really, Microsoft?

2 comments:

  1. So, I see you're blogging again! Next time I need ISS to impersonate a specific user, I'll be sure to use an Administrator account. I was just wondering about that! ;) Actually, I was making sure I had bookmarked all my blogs before iGoogle disappears in a couple more days.

    ReplyDelete
  2. Appreciate you guys you are doing a really terrific job.Panasonic ES-LT71-S

    ReplyDelete