Friday, May 29, 2009

Deploying ASP.NET 2.0 + (IIS, "The page cannot be found", 404.2)

It's been a while since I've had to setup a Windows 2003 server to test Asp.Net apps on so i was a bit baffled when when i couldn't get the website to serve aspx pages. Navigating to the site would result in "The page cannot be found" http 404.


Did all the usual googling, checked the logs at %WINDIR%\System32\Logfiles\W3SVC* which contained lines similar to:

2002-11-25 05:46:15 127.0.0.1 GET /default.asp - 80 - 127.0.0.1 - 404 2 1260


Right, just need to lookup what the "404 2 1260" error means. Despite the detail on that page there's no concrete answers.

Anyway long story short, i had forgotten to register Asp.Net 2.0 with IIS using the old chestnut: aspnet_regiis -i. Allow Asp.Net 2.0 in IIS->Web Service Extensions and away we go.


I'll just slink back to my cave now :(

Sunday, May 24, 2009

Shaping Entity Framework Results

In order to comply with an interface I needed to write code similar to the following:
Which results in:
LINQ to Entities does not recognize the method 'EhrAdmin.Services.MSSQL.DTO.RuleExpressionDTO[] ToArray[RuleExpressionDTO](System.Collections.Generic.IEnumerable`1[EhrAdmin.Services.MSSQL.DTO.RuleExpressionDTO])' method, and this method cannot be translated into a store expression.
I'll revisit this when i get a chance but the fix at the moment is to convert ObjectQuery<actionrule> to List<actionrule> using the ToList() method.

Friday, May 22, 2009

Visual Studio Tip - Hiding Toolbars

I had a funny realization a couple of days ago that I don't actually use any of the default toolbars in Visual Studio. For someone who normally developments on a 24" 1920*1200 monitor it hasn't really been an issue in the past. However I'm currently doing all my development on a 1024*768 laptop, (yeah i know, lame huh?) so I really need all the space I can get.

Funny thing is I don't think I've one needed to reinstated a toolbar yet. Keyboard shortcuts seem to be sufficient for just about everything, ReSharper obviously helps though :)

I'm even tempted to generate the list of Keyboard Shortcuts I currently have enabled.

Html.ActionLink gotcha

For some reason I keep getting tripped up by the following sort of code: Seems simple enough but you end up with a link like : http://localhost:5825/ActionRule/Details?Length=10 Easy fix is to add a null parameter to the end of the list. Why? Well the compiler treats the first call as: Obviously the parameters are resolved incorrectly as there is no method signature such as: I really should write an extension method to cover this (fairly common for me) scenario. Who cares you say? Well to this point it seems that this is the only situation using ASP.Net MVC where I've had to add a null parameter on the end of a call to get the desired result. Not saying it's a bug...just interesting none the less.

Wednesday, May 13, 2009

The view 'Logon' or its master could not be found frustration

Ran into this one again today:

The view 'Logon' or its master could not be found. The following locations were searched:
~/Views/Account/Logon.aspx
~/Views/Account/Logon.ascx
~/Views/Shared/Logon.aspx
~/Views/Shared/Logon.ascx


of course all the files were present because it was working 5 minutes ago (and the 2 weeks or so before that).

I had been using the ASP.Net MVC source project to debug a few things, but reverted to the GAC dll before checking in so that the other devs didn't end up with some phantom project reference. Hence I thought I had not reverted my web.config (and ~/Views/web.config) changes properly.

Anyway half an hour later and a lot of head scratching later I thought I'd see if setting the System.Web.MVC reference to "Copy Local =True" would make any difference
...
it did.

End of story.