Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Configuring IIS Extension Mappings with NAnt

NAnt is a build tool that may be employed to automatically build your ASP.NET project, run unit tests against it using NUnit, deploy the code to a staging server and run webpage "smoke tests" using NUnitAsp.  (If you're not familiar with NAnt, It's often used in conjunction with CC.NET to establish your Continuous Integration environment.)  The NUnitAsp smoke tests simply perform HTTP get requests to make sure that localhost and/or deployed pages aren't blatantly breaking.  In my opinion, using NUnitAsp beyond creating an authentication session and running basic smoke tests causes a lot of unnecessary test-code maintenance.

When using NAnt, a typical objective is to automate the entire get/build/test/deploy/test-deployment process with a relatively clean deployment server.  This ensures that configuration nuances aren't being "assumed to already be in place."  Furthermore, by having your NAnt script perform as much configuration as possible, the build script acts as highly accurate and self-maintaining deployment documentation.  One particular configuration nuance when setting up Castle MonoRail is to add the "*.rails" application extension mapping to IIS.  This configuration must be in place to use NUnitAsp against your NAnt-deployed application.  Although not trivial, configuring IIS with this application mapping can also be automated via NAnt.

After a bit of searching, I found that the developers of Selenium have figured this one out within http://svn.openqa.org/fisheye/rdiff/selenium?csid=261&u&N with a bit of C# scripting.  The attached file, CreateIisAppMapping.build.xml, shows how NAnt can be used in conjunction with a call to NUnit to:  create the IIS virtual directory, remove/add the "*.rails" application mapping, modify the test project's config file to point to the configured server, and run the unit tests - which presumably contain your NUnitAsp unit tests - against the application.  The same testing technique can be used after the code has been deployed to make sure the deployed pages are working.

For further information on setting up your CI environment with NAnt and CC.NET, I recommend reading Expert .NET Delivery by Marc Holmes.

Billy McCafferty

 

kick it on DotNetKicks.com


Posted 07-13-2007 11:50 AM by Billy McCafferty

[Advertisement]

Comments

Christopher Bennage wrote re: Configuring IIS Extension Mappings with NAnt
on 07-13-2007 7:55 PM

Very helpful!

Brian Donahue wrote re: Configuring IIS Extension Mappings with NAnt
on 07-20-2007 10:41 PM

Hi Billy,  I struggled with this myself recently, and I created a Nant task to create an app mapping:

http://www.persistall.com/archive/2007/06/11/Nant-Task-for-Creating-IIS-Application-Mappings.aspx

It builds on top of the IIS tasks in NantContrib.  Example syntax:

<iisappmap vdirname="MLDB.Website"

extension=".jpg"

executable="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"

verbs="GET,POST"

checkfileexists="false" />

Please feel free to use, share, improve!

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)