Read all of ASP.NET MVC 2 in Action now while you wait for the printed book

image First, you should place your advance order for ASP.NET MVC 2 in Action at http://manning.com/palermo2.  That way, you will receive the printed book even before you see it at your local bookstore. 

The entire book is finished, and we are just moving through production right now.  But that doesn’t mean you have to wait to read it and learn about ASP.NET MVC 2.  Since the beginning of the book project, you have been able to see the progression of the book on GitHub, our project site and version control system.  That’s right, version control is for more than just code!

Head over to http://github.com/jeffreypalermo/mvc2inaction and go to the “manuscript” folder to read the entire book in Word document form.  All the content is there.  In fact, the Word documents for the 1st edition is there as well.  You can see just how much we have expanded the 2nd edition to not only cover version 2 but also to incorporate lessons learned using the framework over the last 2 years.

Creative Commons LicenseYou will notice that the raw files in GitHub are released under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.  That means you can use the content in blog posts, whitepapers, and you can use the code samples in any way you like.  The only restriction, really, is that you have to give us credit if you republish portions of it (and you can NOT republish the full work, of course), and you can’t resell our work.  Other than that, use it the best way you can.  We hope it is a great learning tool for you, and we hope that releasing the raw files early help you get a jump-start learning about ASP.NET MVC 2.

Credits:

Authors:  Jeffrey Palermo, Ben Scheirman, Jimmy Bogard, Eric Hexter, Matt Hinze 

Technical Editor:  Jeremy Skinner 

Foreword:  Phil Haack

P.S.  I wish I could say that we are pioneers in this, but I have personally benefited from two others I know about who have worked on their books “out in the open”:

Automating ASP.NET MVC deployments using Web Deploy

The following is an excerpt from ASP.NET MVC 2 in Action, a book from Manning to be in bookstores in May.  The early access (MEAP) edition is available now on http://manning.com/palermo2.  Authors include Jeffrey Palermo, Ben Scheirman, Jimmy Bogard, Matt Hinze.  Technically edited by Jeremy Skinner.

17.4 Enabling remote server deployments with Web Deploy

After getting a deployment script that can set up your application and database, the next step is to take on the challenge of pushing deployments to multiple servers. The key takeaway is that by automating the task of deployment, you can eliminate all the manual steps that are prone to errors.

In order to eliminate the need to log on to servers one by one, an additional technology is needed. This is where the Web Deployment Tool (formerly named MSDeploy) comes into play. You can download it from http://www.iis.net/expand/webdeploy. This tool provides a host of features and functions, , but the features most important for our deployment approach are

  • The ability to sync files over HTTP
  • The ability to execute a remote command

These features support both enterprise and hosted environments, and the scripts can be used for both preproduction environments and production environments.

Typically, for web applications, there will be a development server that hosts the web application and database on the same machine. The quality assurance (QA) environment may be set up the same way. Then, in the staging and production environments, more servers come into play. There may be a separate database server, multiple web servers, and even an application server. Automating a deployment to multiple machines can become complex very quickly. In order to reduce the complexity, Web Deploy can be used to sync files to multiple machines and execute the deployment script on each server. It can also run remotely so that deployments execute the same way that they would in the development environment.

Listing 17.4 shows the command-line arguments used to copy deployment files from a build server to a web server and then run the deployment.

Listing 17.4 Using Web Deploy to remotely execute a deployment

msdeploy.exe  -verb:sync -source:dirPath=deploymentFiles               |#1
-dest:dirPath='c:installs',computername=192.168.1.34                  |#1

msdeploy.exe  -verb:sync                                               |#2
  -source:runCommand='c:installsdev.bat'                             |#2 
  -dest:auto,computername=192.168.1.34                                 |#2
#1 Copy files to remote server
#2 Execute command on remote server

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

First, msdeploy.exe is called with the sync verb specifying a source directory on the local machine (#1). This command copies all the files inside the deploymentFiles directory (C:installs) to the remote server (in this case, the computer with the IP address 192.168.1.34).

Next, msdeploy.exe is called with the sync verb, but this time the runCommand argument is specified (#2). This means that Web Deploy will execute the batch file at c:installsdev.bat on the remote server in the same way you would run it if you logged in via remote desktop.

Using a technology like Web Deploy can greatly simplify a complex deployment. By running each command locally on each server in the deployment, scripts will run consistently from the development environment through the production environment. The real advantage is that the calls to msdeploy.exe can be scripted, which means that a multiserver deployment can be totally automated and repeatable. Scripting this type of deployment also means that from a single machine you can monitor a deployment and see the results of each script consolidated on your desktop.

17.5 Summary

When we configure our environment, we must devise a reliable deployment strategy to ensure that the right application is deployed with the correct configuration. At the heart of a solid deployment strategy is continuous integration, which includes practices such as automated deployments and self-testing builds.

With free, widely used open source tools such as CruiseControl.NET, NAnt, NUnit, and others, we can create an automated build and deployment server. By packaging NAnt, a build script, and a bootstrap batch file, we can harness the flexibility and power of NAnt to deploy and configure our application to multiple environments, up to and including production. By layering on the Web Deploy tool to reduce the friction of copying and executing the build scripts across multiple servers, we can have a totally automated solution that’s repeatable and reliable.

Headspring’s MVC Boot Camp now covers MVC 2 – April 21, 22, 23

Sign up here for Headspring popular boot camp class.  The April boot camp cover ASP.NET MVC (version 1 and 2).  Jimmy Bogard, principal consultant and author, is the trainer for this class, and Jeffrey Palermo (me) is the assistant trainer.  If you employer sends 3 or more there is a discount, so be sure to ask about that.

This is a very hands-on class, hence the name “boot camp”.  Your brain will be fatigued at the end of every day.  The material comes directly from how Headspring uses ASP.NET MVC while delivering client projects.  No theory here – only practice.

http://www.headspringsystems.com/services/agile-training/mvc-training/, or call (877) 459-2260.

More info below:

Developers can easily leverage the Model-View-Controller pattern in ASP.NET applications. Pulling logic away from the UI and the views has been difficult within custom application development for a long time. The Model-View-Presenter pattern helps a little bit, but the fact that the view has to delegate to the presenter makes the UI pattern difficult to work with.

Headspring has been using ASP.NET MVC since the original prototype and has presented on the topic at local conferences as well as Microsoft TechEd. Headspring employees are responsible for a book on ASP.NET MVC, as well as MVC Contrib, CodeCampServer, and several community Solution Templates. This boot camp offers the opportunity to share the experience using the ASP.NET MVC Framework on real-world systems. The class is run in our "boot camp" style where we move quickly and deeply through the topics at hand. The class is three days, and a lot of information is packed into those three days. Instead of written labs and individual exercises, the class will work together as a simulated development team and extend an existing application using the techniques learned. The students will work together and learn from each other as well as the instructor.

Topics are separated by day based on student experience and class speed and will be approached using C# as the scripting language of choice.

Instructors for the ASP.NET MVC Boot Camp™ are Jeffrey Palermo and Jimmy Bogard, two of the authors of ASP.NET MVC in Action.

Topics:

  • History/Overview of ASP.NET MVC
  • Separated solution structure
  • Basic & customized routes
  • Customized route handlers
  • Controller selection
  • customized controller factories
  • Controller & Action patterns & anti-patterns
  • Read-only views
  • Data-entry views
  • Presentation Model
  • Advanced ActionResults
  • Action filters and ActionFilterAttribute
  • Server-side validation
  • JQuery integration
  • Deployment and installation
  • Advanced View Helpers
  • AJAX with ASP.NET MVC
  • T4 Templating
  • Connecting with data access, messaging, etc.

Onsite Training Available:

For companies that want to maximize their programming teams, Headspring Systems can create training courses customized to meet your needs. For more contact us at training@headspringsystems.com

ASP.NET MVC in Action podcast with Deep-Fried Bytes crew

Thanks to Keith and Woody for having us on their podcast.  It was a lot of fun.  The podcast is now published.  Here are the details.

Episode 48: Web Development with ASP.NET MVC In Action Authors

About This Episode

In this episode Keith and Woody caught up with the team that wrote the book ASP.NET MVC In Action: Jeffrey Palermo, Ben Scheirman and Jimmy Bogard. The guys discussed the book, what drives their passion around ASP.NET MVC and what is in store for this huge change in ASP.NET development.

Attend free workshop on 3/16: Architecture Analysis Patterns

On Tuesday, 3/16/2010, Headspring is offering another free monthly workshop.  This month, I am leading the workshop, and the topic is:

Architecture Analysis Patterns: How to reason about the structure of an application

Layering, a fundamental concept of software architecture: Layer helps to separate dependencies and to decouple concerns. Most of the industry does layering in name only. It’s lip service. In 23 slides and accompanying commentary, we will explore the fundamental concept of separating layers to absolutely isolate dependencies.

Tuesday, March 16, 2010
2:00 PM to 4:00 PM

Microsoft hosts Headspring at:
Microsoft Technology Center
9606 N Mo Pac Expy
Austin, TX 78759
(map)

Supercharging ASP.NET MVC with MvcContrib (article)

CoDE Magazine has published a new article from me on MvcContrib.  Here is an excerpt:

Hot on the heels of the groundbreaking release of ASP.NET MVC CTP 1 in December of 2007, an open source project called MvcContrib came to life. MvcContrib has enjoyed tens of thousands of downloads since it started in December of 2007. In this article, I will explain MvcContrib; it’s major components, how to use it, and how to get involved in its continued development.

MvcContrib from 30,000 Feet

MvcContrib is a .NET 3.5 SP1 library that provides extensions for use with Microsoft’s ASP.NET MVC Framework. MvcContrib does not provide replacements for parts of ASP.NET MVC.

Click here for the full CoDe Magazine article.

Headspring continues to hire: we will train contract-to-hire positions

Refer to position details: http://www.headspringsystems.com/careers/senior-software-engineer/

Headspring is always looking for good people, and we have continued to expand throughout the downturn in the economy.  Over 2009, I increased our development staff 13%, and already in 2010, it has increased 11% just in the first two months.  We are continuing to grow, and it doesn’t look like it is slowing down.

There are two model which work very well:

  1. Contract-to-hire:  This is when a programmer very confident in his capabilities works on a contractor basis for a project while we both decide if it is a long-term fit.  Some individuals decide they like contracting and continue in that model.
  2. Full-time employment w/ 90-day trial:  This is when a programmer definitely wants full-time work including top-notch benefits.  At about 90 days, we reevaluate the fit.  We or the employee can then decide to enter into a more permanent employment agreement.

I am currently looking for programmer who fit into either category.  Please email seniorsoftwareengineers@headspringsystems.com if you are interested.  Refer to http://www.headspringsystems.com/careers/senior-software-engineer/ for the items to include in the email.  Don’t let the email address fool you.  If you are aspiring to improve yourself but are not at the senior level, we want to speak with you as well.  Smart people are hard to find.  I can train you up, but I can’t make you smarter.  You have to bring that to the table by yourself.

Most companies who hire contract-to-hire won’t train them.  We are different.  Anyone who does any work for us represents us.  I believe that it is critical to our reputation that we equip our people with the tools and knowledge to succeed in any project.  We are very leading-edge, and we use the best tools the industry has available.  This is different from being “bleeding-edge”.  I do not believe in bleeding.  We will adopt those items which have passed the bleeding stage and have proven their value.

It takes several weeks to make it through our screening process, so please understand the lead time.  Identifying the right people is something I take very serious.

Video of C4MVC talk on MvcContrib Portable Areas

Recently, I gave a presentation to the C4MVC virtual user group focus on ASP.NET MVC, and headed up by Eric Hexter.  You can see the meeting info here.  I introduced and walked through a Portable Areas sample.  the purpose of MvcContrib Portable Areas is to provide a component model for ASP.NET MVC.  It’s not perfect, but it is a very powerful model.  Our hope is that, along with MvcContrib participating in the CodePlex Foundation, Microsoft will be able to take some of the code, or perhaps just the idea, and productize it into the much-needed component model for ASP.NET MVC.

http://www.viddler.com/player/81f1a688/