Multiple Controllers Found with the Name 'HomeController'

by Mark Berry 7/3/2008 9:25:00 AM

I've been playing with Billy McCafferty's S#arpArchitecture. I decided to strip the Northwind references out of the sample so I could try the framework on my own project. After removing the Northwind-specific files and renaming the remaining files and namespaces to "MyProject," I kept getting this error when I started the application:  "Multiple controllers found with the name 'HomeController'": 



Sometimes I would instead get a message that no HomeController could be found.

The Controllers project contains one (and only one) HomeController class. If I comment out that class, the project starts fine:  the home page appears as expected. There are no other occurrences of "HomeController" anywhere in the solution--so where is the HomeController that is actually running to display the home page?

The Solution 

With the help of Billy McAfferty in the CodePlex forum, I discovered that there were several instances of Northwind-related DLLs and other files hanging about in various bin and Debug folders, especially in the MyProject.Web\bin folder:

MyProject.Controllers\obj\Debug\Northwind.Controllers.csproj.FileListAbsolute.txt
MyProject.Core\obj\Debug\Northwind.Core.csproj.FileListAbsolute.txt
MyProject.Data\obj\Debug\Northwind.Data.csproj.FileListAbsolute.txt
MyProject.Tests\obj\Debug\Northwind.Tests.csproj.FileListAbsolute.txt
MyProject.Web\bin\Northwind.Controllers.dll
MyProject.Web\bin\Northwind.Controllers.pdb
MyProject.Web\bin\Northwind.Core.dll
MyProject.Web\bin\Northwind.Core.pdb
MyProject.Web\bin\Northwind.Data.dll
MyProject.Web\bin\Northwind.Data.pdb
MyProject.Web\bin\Northwind.Web.dll
MyProject.Web\bin\Northwind.Web.pdb
MyProject.Web\obj\Debug\Northwind.Web.csproj.FileListAbsolute.txt
MyProject.Web\obj\Debug\Northwind.Web.dll
MyProject.Web\obj\Debug\Northwind.Web.pdb

I deleted those files, reran the project, and voilà! I'm back to only one HomeController. (I set a breakpoint in my HomeController class just to be sure it is getting there.) Now the default page appears as expected. Just to be safe, I then followed Billy's suggestion to delete all the bin and obj folders and then do a full rebuild:  yep, still works! Thanks Billy.

Virtualization, Source Control, and Bug Tracking

by Mark Berry 6/6/2008 5:47:00 PM

I attended the San Diego .NET Developer Group on Tuesday. Nick Pearce gave a great presentation on how to use virtual machines as a developer. I jotted down a few notes on topics he and others mentioned.

Virtualization

Some random notes: 

  • Nick is moving from Virutal PC to VMWare for the dual-monitor support.
  • Remember to turn on hardware virtualization support in your computer's BIOS. Some (like my Thinkpad) disable that by default. 
  • A quad-core processor might help performance with multiple virtual machines.
  • Use a separate disk drive for a differencing volume to reduce contention.
  • You can clone a PC image, but use SysPrep or (XP only) NewSID to fix the SID in the clone.

Source Control

Several products were mentioned:  SourceGear Vault, PerForce, Subversion.

Bug Tracking

More products here:  FogBugz (integrates wtih PerForce), Trac, BugTrac, Mingle

Storming the Castle

by Mark Berry 10/21/2007 1:04:00 PM

I've been learning about so many development strategies in the last few months that my head is spinning! My journey has taken me in two main directions:

  1. Learning about concepts like object-oriented programming (OOP), design patterns, test-driven development, and agile development.
  2. Learning about tools that support #1.

This article makes no attempt to be comprehensive about either point; it's mostly just a list of resources that I'm using and may need to refer to again.

Concepts

New books on my bookshelf:

Relevant articles and blogs:

  • Billy McCafferty's NHibernate Best Practices with ASP.NET. According to reader rankings, this is the #1 article in the CodePlex Design and Architecture section. I didn't learn much about NHibernate in this article, but I learned a lot about architecting web applications. He goes into great detail about separation of concerns, keeping the data layer from depending on the domain (business) layer, etc. Downloadable files include a basic sample and an enterprise sample. It's rare to come across someone who knows his stuff and knows how to explain it in writing. McCafferty has both. Tons of links to other resources, as well as over 700 follow-up comments with lots of helpful answers.
  • Billy McCafferty's blog. Maybe I should have started here. It sounds like McCafferty's group has decided to abandon the (somewhat complex) techniques laid out in the preceding article and convert their current development to Castle MonoRail. I've been considering MonoRail; I must say that McCafferty's enthusiastic endorsement after several months of use is encouraging.

Tools 

As usual, Microsoft is doing a great job of promoting upcoming technologies like LINQ and Silverlight, and I've spent some time researching those. But I need something I can work with now, not something in beta. So my attention has turned towards more established technologies, even though they are not from Microsoft.

Object-Relational Mapping (ORM)

It didn't take me long to realize that I did not want to hand-code all the data access logic for my program. It turns out that linking classes to database objects has developed into quite an industry. There are dozens of Object-Relational Mappers (ORMs) out there (Wilson's O/R Mapper and Entity Spaces, for example), but the one I heard about most often was NHibernate. NHibernate is the .NET version of Hibernate, a "persistence engine" for Java. Unlike many free open-source tools, this one seems to have a wide following and to have proven itself in many large, real-world applications.

Built on NHibernate is Castle ActiveRecord, which hides a lot of the complexity of NHibernate but supposedly lets you get to it if you need it.

Web Development Frameworks

Visual Web GUI is a really fascinating framework that lets you build a web app that looks almost exactly like a WinForms app. It's tempting to go down this road, as I would like to do something of a Rich Internet Application (RIA). However, this is a fairly new framework, and seems to be lacking integration experience with ActiveRecord, for example, so I'm currently leaning towards the more established MonoRail.

Castle MonoRail is a .NET approach to Rails(TM) development, popularized by the Linux-based Ruby on Rails. The main benefit here seems to be a pre-built framework that simplifies developing with the Model-View-Controller (MVC) design pattern. It integrates with Castle ActiveRecord, and it supports test-driven development. And, well, Bill McAfferty thinks that the Castle Project is cooler than Jerry Springer

The Castle

So in short, it's starting to look like the Castle Project is my new best friend...unless of course I come across the next great thing tomorrow!  

SoCal Code Camp Rocks!

by Mark Berry 7/7/2007 2:35:00 AM

This past weekend I attended the SoCal Rock & Roll Code Camp, held at the UCSD Extension campus. This really is a cool idea--let anybody who wants to give a talk, get a few corporate sponsors to pay for dinner and a band, then offer the whole weekend free to anyone. Thanks for all the swag! (now what am I going to do with a lime green backpack?)

It turned out that a lot of smart people signed up to talk. I'm noting here the sessions that I attended, more or less in the order in which I attended them, along with blogs and other references to session materials.

Using SubSonic to built (sic) ASP.NET applications that are good, fast, and cheap

I didn't actually attend this session, but I heard some good things about it as a potential Object-Relational Modeling (ORM) platform.

subsonicproject.com

Overview of the ASP.NET AJAX client libraries
Calling "Web Services" with ASP.NET AJAX

Rob Bagby is a Microsoft evangelist from Phoenix and an able speaker. He gave these two sessions on the nitty-gritty of AJAX:  the stuff that lets you communicate directly between a web page and the server without refreshing the whole page.

robbagby.com links to Rob's MSDN blog, where there are lots of webcasts, including Latest ASP.NET Client Libraries Webcast Sample Code And Links To All Sessions.

The Next Leap:  Software Factories and the Microsoft DSL Tools
Modeling and Testing with the Class Designer and Object Test Bench

Kevin McNeish is President and Chief Software Architect of Oak Leaf Enterprises, Inc. Kevin helped bring some pretty esoteric concepts down to earth.

The first session covered the Domain Specific Language (DSL) tools available as part of the Microsoft Visual Studio SDK 4.0. He recommended getting the book just released by the Microsoft team, which must be Domain-Specific Development with Visual Studio DSL Tools, ISBN 0321398203.

The second session went into detail about how to use the class designer that is built into Visual Studio, along with the PowerToys for the Visual Studio 2005 Class Designer. Unfortunately, Microsoft has killed GotDotNet.com, so there is currently no place to download these PowerToys (MSDN forum gripe). Edit:  the PowerToys are now available on CodePlex.

Object Modeling 101

Eric Kaufmann hosted a great session on the basics of object modeling. The audience (myself included) kind of got him off track by peppering him with questions about the real-world CRM example that he was kind enough to show. Finally! a presenter with a similar (database-driven) background, showing actual code for an application I can relate to. Of particular interest was the way his data layer was built using NHibernate for .NET. Eric's follow-up blog entry includes a link to the book Head First Object-Oriented Analysis and Design: A Brain Friendly Guide to OOA&D, ISBN 0596008678.

Architecting ASP.NET Applications

Paul Sheriff is the President of PDSA, Inc. This talk focused on his methodology for creating ASP.NET applications, offering lots of practical tips for creating a WebBasePage class, user controls, session variables, exception handling, etc. He referred to a sample application, but I'm not clear where to get it. Paul's other site is Paul Sheriff's Inner Circle, a paid membership site for developers.

Building Rich & Interactive Web Applications with ASP.NET AJAX
Why You Need .NET Coding Standards

David McCarter's AJAX session focused on several of the controls in the Microsoft AJAX toolkit. This talk presented a nice complement to Rob Bagby's sessions on the more behind-the-scenes use of client libraries (see above).

Although David gave the .NET Coding Standards talk at Code Camp, I didn't actually hear this talk until Tuesday, when he presented it again at the San Diego .NET Developers Group meeting. This is David's specialty, the subject of his book VSDN Tips & Tricks .NET Coding Standards, and it was great to hear him talk on it. 

David blogs at blog.davidmccarter.net

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen. Customized by Mark Berry.

About the author

Mark Berry Mark Berry owns MCB Systems, a firm active in both IT administration and .NET software development.

E-mail me Send mail
`

Disclaimer

The opinions expressed herein are my own personal opinions and absolutely represent my employer's views. I'm self-employed! Please keep in mind that what worked for me or someone else may not apply to your situation. Always have a good backup, and use any information here at your own risk!

Entire contents copyright © 2008 by MCB Systems. Sign in