Deploying MVC on IIS 6

July 2, 2009 12:06 by bryan

If and when you have to deploy your MVC application, you'll soon find out that IIS6 does not support Url Rewriting.  There are a number of options available to you, for a good list check out Steve Sanderson's Deploying ASP.NET MVC to IIS 6, the one I'm currently using is:

 

Use a wildcard mapping for aspnet_isapi.dll

This tells IIS 6 to process all requests using ASP.NET, so routing is always invoked, and there’s no problem. It’s dead easy to set up: open IIS manager, right-click your app, go to Properties, then Home Directory tab, then click Configuration. Under Wildcard application maps, click Insert (not Add, which is confusingly just above),  then enter C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for “Executable”, and uncheck Verify that file exists.

Done! Routing now just behaves as it always did in VS2008’s built-in server.

Unfortunately, this also tells IIS to use ASP.NET to serve all requests, including for static files. It will work, because ASP.NET has a built-in DefaultHttpHandler that does it, but depending on what you do during the request, it might use StaticFileHandler to serve the request. StaticFileHandler is much less efficient than IIS natively. You see, it always reads the files from disk for every request, not caching them in memory. It doesn’t send Cache-Control headers that you might have configured in IIS, so browsers won’t cache it properly. It doesn’t do HTTP compression. However, if you can avoid interfering with the request, DefaultHttpHandler will pass control back to IIS for native processing, which is much better.

For small intranet applications, wildcard mappings are probably the best choice. Yes, it impacts performance slightly, but that might not be a problem for you. Perhaps you have better things to worry about.

For larger public internet applications, you may need a solution that delivers better performance.

Snippet taken from Steve Sanderson's Deploying ASP.NET MVC to IIS 6

 

For more information take a look at ScottGu's blogTip/Trick: Url Rewriting with ASP.NET


Culture Codes

June 19, 2009 11:07 by bryan

 

A comprehensive list of culture codes used for localising and in conjunction with the CultureInfo class.

The CultureInfo class specifies a unique name for each culture, based on RFC 4646 (Windows Vista and later). The name is a combination of an ISO 639 two-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code associated with a country or region.

CodeLanguage - Country/RegionCodeLanguage - Country/Region
af Afrikaans hu-HU Hungarian - Hungary
af-ZA Afrikaans - South Africa is Icelandic
sq Albanian

 

is-IS Icelandic - Iceland
sq-AL Albanian - Albania id

 

Indonesian
ar Arabic id-ID Indonesian - Indonesia

 

ar-DZ Arabic - Algeria it Italian
ar-BH Arabic - Bahrain it-IT Italian - Italy
ar-EG Arabic - Egypt it-CH Italian - Switzerland
ar-IQ Arabic - Iraq ja Japanese
ar-JO Arabic - Jordan ja-JP Japanese - Japan
ar-KW Arabic - Kuwait kn Kannada
ar-LB Arabic - Lebanon kn-IN Kannada - India
ar-LY

 

Arabic - Libya kk Kazakh
ar-MA Arabic - Morocco

 

kk-KZ Kazakh - Kazakhstan
ar-OM Arabic - Oman kok

 

Konkani
ar-QA Arabic - Qatar kok-IN Konkani - India

 

ar-SA Arabic - Saudi Arabia ko Korean
ar-SY Arabic - Syria ko-KR Korean - Korea
ar-TN Arabic - Tunisia ky Kyrgyz
ar-AE Arabic - United Arab Emirates ky-KG Kyrgyz - Kyrgyzstan
ar-YE Arabic - Yemen lv Latvian
hy Armenian lv-LV Latvian - Latvia
hy-AM Armenian - Armenia lt Lithuanian
az

 

Azeri lt-LT Lithuanian - Lithuania
az-AZ-Cyrl Azeri (Cyrillic) - Azerbaijan

 

mk Macedonian
az-AZ-Latn Azeri (Latin) - Azerbaijan mk-MK

 

Macedonian - Former Yugoslav Republic of Macedonia
eu Basque ms Malay

 

eu-ES Basque - Basque ms-BN Malay - Brunei
be Belarusian ms-MY Malay - Malaysia
be-BY Belarusian - Belarus mr Marathi
bg Bulgarian mr-IN Marathi - India
bg-BG Bulgarian - Bulgaria mn Mongolian
ca Catalan mn-MN Mongolian - Mongolia
ca-ES Catalan - Catalan no Norwegian
zh-HK

 

Chinese - Hong Kong SAR nb-NO Norwegian (Bokm?l) - Norway
zh-MO Chinese - Macao SAR

 

nn-NO Norwegian (Nynorsk) - Norway
zh-CN Chinese - China pl

 

Polish
zh-CHS Chinese (Simplified) pl-PL Polish - Poland

 

zh-SG Chinese - Singapore pt Portuguese
zh-TW Chinese - Taiwan pt-BR Portuguese - Brazil
zh-CHT Chinese (Traditional) pt-PT Portuguese - Portugal
hr Croatian

 

pa Punjabi
hr-HR Croatian - Croatia pa-IN Punjabi - India
cs Czech ro Romanian
cs-CZ Czech - Czech Republic ro-RO Romanian - Romania
da

 

Danish ru Russian
da-DK Danish - Denmark

 

ru-RU Russian - Russia
div Dhivehi sa

 

Sanskrit
div-MV Dhivehi - Maldives sa-IN Sanskrit - India

 

nl Dutch sr-SP-Cyrl Serbian (Cyrillic) - Serbia
nl-BE Dutch - Belgium sr-SP-Latn Serbian (Latin) - Serbia
nl-NL Dutch - The Netherlands sk Slovak
en English sk-SK Slovak - Slovakia
en-AU English - Australia sl Slovenian
en-BZ English - Belize sl-SI Slovenian - Slovenia
en-CA English - Canada es Spanish
en-CB

 

English - Caribbean es-AR Spanish - Argentina
en-IE English - Ireland

 

es-BO Spanish - Bolivia
en-JM English - Jamaica es-CL

 

Spanish - Chile
en-NZ English - New Zealand es-CO Spanish - Colombia

 

en-PH English - Philippines es-CR Spanish - Costa Rica
en-ZA English - South Africa es-DO Spanish - Dominican Republic
en-TT English - Trinidad and Tobago es-EC Spanish - Ecuador
en-GB English - United Kingdom es-SV Spanish - El Salvador
en-US English - United States es-GT Spanish - Guatemala
en-ZW English - Zimbabwe es-HN Spanish - Honduras
et Estonian es-MX Spanish - Mexico
et-EE

 

Estonian - Estonia es-NI Spanish - Nicaragua
fo Faroese

 

es-PA Spanish - Panama
fo-FO Faroese - Faroe Islands es-PY

 

Spanish - Paraguay
fa Farsi es-PE Spanish - Peru

 

fa-IR Farsi - Iran es-PR Spanish - Puerto Rico
fi Finnish es-ES Spanish - Spain
fi-FI Finnish - Finland es-UY Spanish - Uruguay
fr French es-VE Spanish - Venezuela
fr-BE French - Belgium sw Swahili
fr-CA French - Canada sw-KE Swahili - Kenya
fr-FR French - France sv Swedish
fr-LU

 

French - Luxembourg sv-FI Swedish - Finland
fr-MC French - Monaco

 

sv-SE Swedish - Sweden
fr-CH French - Switzerland syr

 

Syriac
gl Galician syr-SY Syriac - Syria

 

gl-ES Galician - Galician ta Tamil
ka Georgian ta-IN Tamil - India
ka-GE Georgian - Georgia tt Tatar
de German tt-RU Tatar - Russia
de-AT German - Austria te Telugu
de-DE German - Germany te-IN Telugu - India
de-LI German - Liechtenstein th Thai
de-LU

 

German - Luxembourg th-TH Thai - Thailand
de-CH German - Switzerland

 

tr Turkish
el Greek tr-TR

 

Turkish - Turkey
el-GR Greek - Greece uk Ukrainian

 

gu Gujarati uk-UA Ukrainian - Ukraine
gu-IN Gujarati - India ur Urdu
he Hebrew ur-PK Urdu - Pakistan
he-IL Hebrew - Israel uz Uzbek
hi Hindi uz-UZ-Cyrl Uzbek (Cyrillic) - Uzbekistan
hi-IN Hindi - India uz-UZ-Latn Uzbek (Latin) - Uzbekistan
hu Hungarian vi Vietnamese

 


Running NUnit from Visual Studio

June 15, 2009 09:17 by bryan

If you are like me, I like to keep my Visual Studio environment as clean as possible, so if I can get away from adding any addins in to Visual Studio I will always go for that option.

So when it comes to testing I prefer to run with NUnit and run it as n external program.  

To do this just right click on the unit test project -> choosing the properties option -> setecting the Debig tab -> choose "start external program" and enter the NUnit assembly path, in my case this is "C:\Program Files\NUnit 2.5\bin\net-2.0\nunit.exe", next is to select the command line arguments and point this to your unit test dll,

e.g.  "C:\Program Files\NUnit 2.5\samples\csharp\money\bin\Debug\cs-money.dll" /run

The "run" parameter will automatically run the loaded project

 


MVC Validation

June 10, 2009 10:15 by bryan

Validation is such an important part of development, and the best way I have found for the MVC is by Steven Sanderson, xVal, which is a validation framework for ASP MVC, even Scott Gu things it is absolutely fantastic.

If you are after using xVal with Linq to SQL then it is well worth check out Integrating xVal Validation with Linq-to-Sql by Adam Schroder

It's worth checking out Client-side form validation made easy by Adrian Grigore to extend this even further validation.

Don't take my word for is, check out, ASP.NET MVC Validation Refresh: Best Techniques & Frameworks by Graham O’Neale


Scrum the story

June 1, 2009 14:10 by bryan


Speed and Performance of LINQ

May 26, 2009 15:10 by bryan

I was wondering today if anyone had produced any benchmarks on the speed and performance of LINQ, so I had a look around and found that LINQ 2 SQL is 4 times faster than the Entity Framework.  Why is this?  It is due the the fact that the Entity Framework is a more generic solution, where as LINQ to SQL can be more fine tuned to the underlying database structure.

Here are a few links I found that might explain things in more details

ADO.NET Entity Framework Performance Comparison

How Slow is 'Slow'?


Managing Sprints in a Scrum

May 26, 2009 11:12 by bryan

There are many ways of managing a Scrum Sprint, but I always look for the easy ways, I came across Deborah Hartmann, spreadsheet which I have found very useful and easy to get along with.  Once you understand the processes of Scrum and what is required the spreadsheet speak a thousand words.

Sprint Backlog.xls (5.68 mb)


Tools for Linq to SQL and ADO.NET Entity Framework

May 26, 2009 09:06 by bryan

I have found LINQ to SQL and the Entity Framework has a few missing features, one of these is the ability to update the designer diagrams, and this is where Huagati DBML come to play.

Huagati DBML/EDMX Tools is an add-in for Visual Studio that adds functionality to the Linq2SQL/DBML diagram designer in Visual Studio 2008, and to the ADO.NET Entity Framework designer in Visual Studio 2008 SP1.


DDD South West Presentations for Room 3

May 24, 2009 07:31 by bryan

Here is a list of Slides and Source code for DDD South West 2009 room 3

For full details on each of the talk check out the Agenda 

These files are now on the DDD South West web site

Here are some photos too

http://picasaweb.google.co.uk/bryanavery102/DDDWouthWest#

 

 


Mocking

May 22, 2009 14:33 by bryan

In object-oriented programming, mock objectsare simulated objects that mimic the behavior of real objects in controlled ways. A computer programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.

It is possible to perform integration testing on the Membership Provider, take a look at this blog entry to find out more Integration testing the MembershipProvider

Within the Project we are using Rhino MocksOren Eini is doing a great job with this framework, and I think it's the only one that seems to be keeping up with the latest features in .NET, other than TypeMock. Plus, it's totally free to use. It's also the only one other than TypeMock which does not require you to input strings for method names you'd like to mock, which is cool. It's compelling to use it but the project is currently maintained by just one person. If Oren decides to drop it, or for any reason stop working on it, the book might turn out outdated quite quickly. Plus, it's not very widely used, though it seems to be gaining in popularity.

References

Introduction to Mocking with Rhino Mocks

Mocking

Code Samples