Category Archives: .NET

Great Conversation with Chris Tavares about Microsoft Unity

I had a really great conversation recently with Chris Tavares, the lead developer of the Unity Application Block for Microsoft.  The chat was for my weekly article on InfoQ.  Please check it out. patternspractices

Some information on Unity to get going:

There are certainly a good number of Dependency Injection contains for .NET which have either been around for a long time or have sprung up recently.  I am planning a post covering them in a bit of detail for those interested in learning about DI containers or understanding what is available.

Ruby on Rails and IIS7 Playing Nicely Together

Ruby on Rails has been around for a few years now and has become a hugely popular web development framework, but not on Windows and Internet Information Server (IIS).  Rails has run on Linux and Max OSX almost exclusively, until recently. 

The Ruby on Rails Wiki has a very good article on setting up Ruby on Rails using IIS7.

Enter FastCGI

FastCGI is the key to getting Rails running in IIS.  The FastCGI web site describes FastCGI as:

FastCGI  is a language independent, scalable, open extension to CGI that provides high performance without the limitations of server specific APIs. See the docs for more details.

Dave Scruggs has a nice short tutorial about his experience getting Rails running on Windows Visata SP1 and IIS 7 with FastCGI.  One of the really nice features of Vista SP1 is that it includes FastCGI built-in. 

In the event you are running IIS7 without FastCGI built in, Dave points out a good tutorial from Carlos Caneja called Install FAST CGI on IIS7.

FastCGI is used to serve applications on IIS7 for languages such as:

  • Ruby
  • Python
  • PHP
  • and others….

What about IIS6?

Most of the recent resources on the web I have seen show FastCGI applications running on IIS7, mainly because it is built-into Vista SP1 and that avoids some configuration difficulties but IIS6 does has FastCGI support for it.  I have not personally attempted it but I may in the future.   The IIS.NET site has some information about using FastCGI on IIS6.

It seems the primary support for FastCGI from Microsoft is on IIS7 but not everyone may be at the point where their web servers are running IIS7 just yet. 

Personal Setup

The tutorials given here are very good and work really well with Vista.  I have a VMWare VM setup on my MacBook Pro running Vista SP1, the setup was flawless.  I have an advantage of many years of IIS experience with a couple years of Ruby on Rails experience, which I think does help.

I would like to see some performance numbers of running Rails or any FastCGI hosted application under IIS.  I am not aware of any but would like to hear back from someone putting IIS and FastCGI through it paces.

Technorati Tags: ,,,

Great find – The Thirsty Developer Podcast

I have to admit, I have a problem.   I am addicted to podcasts and I listen to them all, either on a commute to a client or while working.  I stumbled across a new one (to me) recently and I wanted to share it with my readers. ThirstyDeveloper_small

It’s called The Thirsty Developer and it covers development from a fairly platform agnostic view.  Recent shows cover topics such as:

  • Scrum
  • Collaboration between Developers and Designers
  • Continuous Integration
  • Globalization and Localization

They do cover such specific topics such as:

  • Silverlight 2
  • IIS

As I write this there are 16 episodes and just need to check out the podcast feed to see all the episode details.    The sound quality on many podcasts, especially new ones varies a lot but they seem to have gotten it right.  The sound quality is excellent and the conversations good too.

Technorati Tags: , ,

ASP.NET MVC Source Code Now Available – ScottGu’s Blog

As an fan of all things MVC, today’s news of the release of the ASP.NET MVC Source Code was really good news.  I think it shows Microsoft’s continued steps toward being open source. 

Scott Guthrie was the one breaking the news and he has some details on his blog to check out.  The source was released as part of a CodePlex project and can be found as part of the ASP.NET CodePlex project, where the source can be found and downloaded.

Scott Hanselman also has a great post about his thoughts on the ASP.NET MVC source code and goes into some detail in The Weekly Source Code.  It’s really nice to see Scott spend the time pointing us to various areas of the source code.  It’s good stuff and worth the read.

In case you missed one of Scott’s earlier examination of the ASP.NET MVC Source you should also check it out.

Fixing the Toolbox in Visual Studio 2005

I have had the extreme pleasure of working with Microsoft SQL Server 2005 Reporting Services lately (notice the extreme sarcasm in my tone).  I am working on a project for a large client and one part of the project requires I enhance a report to support multiple languages.   This post is not about localization but a rather strange issue I faced today.

I opened up my project in Visual Studio and proceed to open the report I needed to analyze for changes and decided to look at the controls at my disposal to help enhance the report and was greeted by this set of controls:

ReportingServicesToolBoxBefore

Interesting, all the controls are just Textbox.  Obviously this isn’t right and I had to do a bit of searching around the net for a few things to try.  The first suggestion I found was to right click the Toolbox and select Reset ToolBox….this had no effect.  Several suggestions didn’t seem right but I finally tried one which worked.  It involved a few steps:

  1. Shutdown Visual Studio
  2. Locate the directory – C:\Documents and Settings\<user name>\Local Settings\Application Data\Microsoft\VisualStudio\8.0
  3. Delete all files named Toolbox.* (there were 4 of them)
  4. Restart Visual Studio

The directory listing where the Toolbox files live looked like this:

VisualStudioToolBox

When Visual Studio restarts it will recreate the Toolbox files based on what is installed on the system.  After restarting Visual Studio my Toolbox looked like this when editing a report:

ReportingServicesToolBoxAfter

The steps are pretty trivial when you know what they are but finding the solution took a bit of spelunking but it worked like a charm.  I don’t know what actually caused this to happen but I don’t have the time to find out why.  If someone has the reason I would love to know why.

ASP.NET MVC Framework Preview 2 – Changes for the Better

The team providing us with the ASP.NET MVC Framework made available the 2nd preview release during the MIX08 Conference March 5-7, 2008 in Las Vegas, NV.  This release has many great changes as they team works toward an RTM maybe later in the year, but no promises were made.

I just wanted to point out some of the bigger changes in the Preview 2 release.

The ASP.NET MVC Framework can be deployed in the \bin directory of an app and work in partial trust

One of the pain-points in the current CTP of the ASP.NET MVC Framework is the framework is installed with a setup program to register it in the Global Assembly Cache (GAC), this is fine for local installations on development machines but not good when need to deploy to other systems.  Microsoft is fixing this:

Starting with this upcoming preview release we will enable applications to instead directly reference the System.Web.Mvc.dll assembly from the application’s \bin directory.  This means that no setup programs need to be run on a sever to use the ASP.NET MVC Framework – you can instead just copy your application onto a remote ASP.NET server and have it run (no registration or extra configuration steps required).

Requiring  System.Web.Mvc.dll to be in the GAC also made it unlikely to be able to use the MVC framework with shared hosting providers, the new CTP will also fix this potential problem as well:

We are also doing work to enable the ASP.NET MVC framework to run in “partial/medium trust” hosting scenarios.  This will enable you to use it with low-cost shared hosting accounts – without requiring the hosting provider to-do anything to enable it (just FTP your application up and and it will be good to run – they don’t need to install anything).

It’s unlikely anyone would have faced these issues yet, since the MVC is so new, but good to know it was thought out in advance.

Significantly enhanced routing features and infrastructure

URL routing is one of the most powerful features of the MVC framework, letting developers have infinite control over the structure of the URL’s in their applications. 

This upcoming ASP.NET MVC preview release contains even more URL routing features and enhancements.  You can now use named routes (enabling explicit referencing of route rules), use flexible routing wildcard rules (enabling custom CMS based urls), and derive and declare custom route rules (enabling scenarios like REST resources mappings, etc).

We have also factored out the URL routing infrastructure from the rest of the MVC framework with this preview, which enables us to use it for other non-MVC features in ASP.NET (including ASP.NET Dynamic Data and ASP.NET Web Forms).

Improved VS 2008 Tool Support

The initial release of the MVC framework shipped with some useful but simple templates for web projects but improvements are coming:

This upcoming ASP.NET MVC preview release will ship with improved VS 2008 integration.  This includes better project item templates, automatic project default settings, etc.  We are also adding a built-in “Test Framework” wizard that will automatically run when you create a new ASP.NET MVC Project via the File->New Project dialog.  This will enable you to easily name and wire-up a unit test project for your ASP.NET MVC application.

The Test Framework wizard will allow the developer to choose from a list of available unit testing frameworks but is pluggable to allow for additional testing frameworks to be added.

[ControllerAction] Attribute No Longer Required on Controller Action Methods

The first MVC framework required developers to use the [ControllerAction] attribute to distinguish action methods on a controller in order for it to be callable from an application.  Due to developer feedback the new release will do away with this requirement and make all public methods defined on a controller to be action methods and therefore callable.

There will be attributes available to use to make a public method a non-action method.

New Filter Attribute Support for Controllers and Action Methods

A new feature being added to the release are Filter Attributes.  Basically, these attributes are actions a developer may want to execute either before or after a controller or its action executes.

These enable you to inject code interceptors into the request of a MVC controller that can execute before and after a Controller or its Action methods execute.  This capability enables some nice encapsulation scenarios where you can package-up and re-use functionality in a clean declarative way.

HTML Helpers Built-in

Helper methods were limited in the first release of the framework, where a separate download was made available which included a bunch of HTML helper methods.  The new release will have all of the optional helper methods built-in.  Future framework updates will include ASP.NET AJAX support:

Next month we are also going to start to talk about some of the new enhancements to the client-side ASP.NET AJAX libraries we are making, as well as some of the AJAX helper methods we will build to enable it to easily integrate with ASP.NET MVC.

These were the HTML helper methods developed by Rob Conery.

Lots of Refactoring and Design Improvements

As with any public CTP of a product, the idea is to iterate and evolve the product into something people will use.  The team is making design improvements to the existing code base to allow for better extensibility.

In general the team has followed a philosophy where for all features you have three options:

  1. Use the built-in features/implementations “as-is” out of the box
  2. Slightly customize the built-in features/implementations without having to write much code
  3. Completely swap out the built-in features/implementations for custom ones

For example: you can now override the ViewEngine locator logic without having to override the ViewEngine execution logic (and vice-versa) – or alternatively swap out ViewEngines entirely.  The Controller Factory support has been extended to make it even easier to integrated with dependency injection frameworks.  Route rules are now fully extensible.  Controllers are more easily testable, etc.

This type of flexibility gives developers choices, not forcing them into doing things a certain way which can help improve the ability for developers to more quickly adopt the framework.

Downloadable ASP.NET MVC Framework Source that can be Built and Patched

Following the lead of downloadable .NET Framework source code, the team will be making the source code for the MVC framework available with the same methods.

Starting with this next preview, we are also going to make the ASP.NET MVC Framework source code downloadable as a buildable VS project solution.  This will enable you to easily view and debug the ASP.NET MVC Framework source code.  We are also going to include a license that permits you to optionally make patches to the ASP.NET MVC Framework source code in the event that you run into a bug in an application you are developing with it.

The license won’t enable you to redistribute your patched version of ASP.NET MVC (we want to avoid having multiple incompatible ASP.NET MVC versions floating around and colliding with each other).  But it will enable developers who want to get started building ASP.NET MVC applications immediately to make progress – and not have to worry about getting blocked by an interim bug that they can’t work around.

Screencasts Showing-off Features

Scott Hanselman has put out some great screencasts to show off how the ASP.NET MVC works in its current iteration.  At the time I write this there are 4 screencasts available showing increased complexity while working on the same sample code base.

Also available is Scott’s session at MIX08

Developing ASP.NET Applications Using the Model View Controller Pattern

I have taken the time to work with this Preview 2 of the ASP.NET MVC Framework and developed some simple applications, which worked wonderful.  My experience with Ruby on Rails really helps in understanding this framework.  Comparing the first CTP to this one is really a night and day difference, in my opinion.  I am looking forward to future releases and building real applications this way on .NET.

Great Interview at MIX08 with John Lam

Aaron Junod, my co-author of Professional IronRuby I talked about already, did a great interview with John Lam at the recent MIX conference in Las Vegas.  Aaron asked some great questions and as always John answered them very openly giving all those IronRuby enthusiasts something to look forward to.

The interview covers a lot, including:

  • IronRuby
  • Microsoft and Open Source
  • Microsoft working with Open Source developer community
  • Future of IronRuby and the Microsoft dynamic languages

Please check out the interview with John Lam at the RubyDoes.NET web site.