So I’ve got an ASP.NET Web Forms application that needs maintaining. And it’s still running the Microsoft .NET Framework 3.5. The size, complexity and availability of external components from third-party vendors make an upgrade to the .NET Framework 4 too risky. Am I stuck dealing with server-side controls and post backs? Heck, no! Thanks to ServiceStack, I can easily enhance that application.

What Is ServiceStack?

I don’t want to rehash the materials from the ServiceStack Web site, so I’ll just say that ServiceStack is a simple, clean and all-around great framework for creating services in the .NET Framework. While version 4.0 is a commercial release, the 3.x code is still open source and totally functional.

Why use ServiceStack instead of the ASP.NET MVC or ASP.NET Web API frameworks? Well, I still need to support the .NET 3.5 site so the Web API is out (it requires at least the .NET 4 runtime), and MVC hasn’t supported the .NET Framework 3.5 since version 2 (current version of ASP.NET MVC is version 5). So not only does ServiceStack still support the .NET Framework 3.5, it’s pretty easy for me to plug in to an existing Web Forms application.

Why not set up a brand-new Web site? Well, depending on infrastructure, that can be more complicated. And, in this particular case, I had an existing application with some features I wanted to take advantage of (authentication, application information stored in the ASP.NET session and so on). Creating a whole new Web site seemed a bit overkill.

This article will give you an overview of the integration points for a Web Forms application that utilizes ServiceStack. It is not an extensive overview or even an introduction to ServiceStack. You can get more details on ServiceStack features by visiting the Web site. (If you’d like to see more coverage of ServiceStack, drop me an e-mail.)

Getting Started

Thanks to NuGet, adding ServiceStack to my existing Web Forms application was easy, but did come with one important wrinkle: Starting with NuGet version 2.8 (released January 2014), dependency resolution changed from favoring the highest available version to favoring the lowest available version. To be fair, this is a more sound strategy (see the NuGet 2.8 Release Notes for more details), but it causes problems with the way ServiceStack is packaged. However, by using the Package Manager console, I can change the dependency resolution to the way it used to be (using the highest available version number):

PM> Install-Package ServiceStack -Version 3.9.71 -DependencyVersion Highest

This installs all required binaries and references for ServiceStack into my Web Forms application.


Shine Up Those Older Web Forms Applications with ServiceStack
1.10 GEEK