The new Microsoft at BUILD 2016

I attended Microsoft’s annual developer conference BUILD and am pretty excited about this new Microsoft that has emerged under the guidance and leadership of Satya Nadella.  A lot of my surprise comes from the new services and APIs that Microsoft has announced at the conference.

The Cognitive Services APIs offer an amazing opportunity for creating new software that makes the works a better place and improves our everyday lives. Combine these services with the Bot Framework and you can build anything you can imagine.

Some of the surprises, however, are based not on what was said but rather what was not said.

Microsoft seems to have quietly moved away from KnockoutJS in favor of Anugular 2.0 (a Google library). The conference even had a couple Google engineers manning an Angular booth along-side the Azure and ASP.NET teams. The ASP.NET Core code lab session on front-end development integrates Angular 2 within the ASP.NET (5/Core) MVC (6/Core) applications.

This is an interesting and welcome change Microsoft is open and getting along with Google and demoing on Apple products. Instead of trying to force their stack on the dev community, Microsoft has allowed the organic winners in each arena to play nicely together and is updating their tools to help you integrate.

Windows Phone was also nowhere to be found. All mobile device demos were done on iPhones (at least the ones I saw). As much as they would love to be a true contender in the mobile device space, I’m happy to see Microsoft doubling down on their strengths.

Is Node.js better than ASP.NET, ASP.NET MVC?

Is Node.js better than ASP.NET, ASP.NET MVC?

What I’m writing is in no way a ciricism of Node.js but the hype that some have blindly bought into. Javascript is a great language and Node.js is a good API built on Google’s V8 engine but it’s not the end all and be all that some people make it out to be.

But isn’t Node.js faster than ASP.NET? Well is depends.
Are we talking about development time?
Are we talking about time to first byte?
Are we talking about

But isn’t ASP.NET slow? Efficient, asynchronous .NET code can run circles around blocking Node.js code any day. Remember that while Node.JS allows you to develop non-blocking code, it is possible to still write blocking, synchronous code with Node.js.

Yes, Node.js makes writing non-blocking code easier, but so does .NET. I can write efficient, non-blocking code in .NET just as well as I could write in-efficient, blocking code in Node.js.

Javascript is a great, minimalistic language.
V8 is an amazing virtual machine…similar to Sun/Oracles JVM (Java) and Microsoft’s .NET framework and CLR.
Node.js is a phenominal set of libraries that have been built acount Google’s V8 engine.

It is a good language and platform, but it’s not the end all and be all that some people make it out to be.

BUT but…NPM!!

  • Java has maven and ivy
  • .NET has Nuget
  • Node.js has NPM

The package manager pattern has been around for a long time and has made things much easier for developers. NPM is a great package manager but it’s nothing new.

The dominance of Node.js (the new hotness) over ASP.NET and other (lets say older) server side technologies is accepted as canon in certain circles. Which is better? Like most open ended questions such as this one, the answer is depends?

Many people like to ask questions like “What’s the best language to use for XYZ?” and the answer is always the same…’It depends!’

Further Reading


Deploying an ASP.NET Web Application with SQL CE 4 & Entity Framework without installation

Update – 12/15/2011

As of Visual Studio 2010 SP1, there’s an easier way to do everything below.

In the Solution Explorer, right click the project and select ‘Add Deployable Dependencies…’, select the dependencies you want to include, and click OK.

Visual Studio 2010 - Add Deployable Dependencies

This will generate the folder _bin_deployableAssemblies with the proper DLLs. Now when you build your solution, the DLLs in _bin_deployableAssemblies are copied to the bin folder.

See Scott Hanselman’s post for a more thorough explanation.

Original Post

I have built an ASP.NET project using SQL CE 4.0 and Entity Framework 4.1. When the time came to deploy the web application to our managed environment, I ran into some issues due to some missing references.

Do to the nature of our hosted environment, installing the EntityFramework and SQLCE4 libraries was not an option but I have worked out all of the required steps to get the web application working in the deployed environment.

Referenced Libraries

The following libraries should be referenced in your project.


Make sure to set the Copy Local property to true.

Manual Copy

The following files should be copied as part of your build script process. These files are placed on your file system when you install the SQL CE 4 package.



On my development box, the machine.config has been modified (when I installed SQL CE 4) to include the SQL CE 4 provider. To use the provider without explicitly installing it on the server, we need to manually add the provider in the Web.config

      <remove invariant="System.Data.SqlServerCe.4.0" />
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

Client side sorting with ASP.NET GridView and jQuery TableSorter

UPDATE If you are looking for a more complete solution including filtering, search, paging, and server side sorting, look at my post on using the datatables plugin with ASP.NET.

Doing some quick data prototyping, I employed the use of the ASP.NET GridView to quickly report on my data objects. As is common, the prototypes quickly took on a life of their own and were asked to be matured into a full on reporting application.

For client-side sorting, I have been using the jQuery Tablesorter plugin. To integrate this plugin, you need simply call the initializing function.


  $(document).ready( function(){

Out of the box, however, the plugin will not work with the <table> node generated by the ASP.NET Gridview. Comparing the generated output from the GridView with the demo table I realized that the vanilla GridView doesn’t generate the <thead> nodes for the table’s header. To get the proper output, the following changes need to be made in the code behind.

gv.Datasource = myDataSource;

//Here's the required code to add
gv.UseAccessibleHeader = true;
if (gv.HeaderRow != null)
   //This will tell ASP.NET to render the <thead> for the header row 
   //using instead of the simple <tr>
   gv.HeaderRow.TableSection = TableRowSection.TableHeader; 

jQuery Datatables with C# / .NET web services

I just completed a project where I integrated that jQuery Datatables plugin The documentation from the Datatables website was helpful but there were a gaps that needed extended documentation.

This particular implementation uses an ASMX service for the underlying service. The plugin is integrated with my <table> with the following call.

        bJQueryUI: true,
        sPaginationType: "full_numbers",
        bProcessing: true,
        bServerSide: true,
        sAjaxSource: '/Services/MyService.asmx/MyWebMethod',
        fnServerData: function (sSource, aoData, fnCallback) {
            var jsonIn = '{ delimiter: "|", delimitedTags: "' + strTags + '", pageSize: 100, skip: ' + aoData[3].value + ', sortColumn: ' + aoData[47].value + ', sortDirection: "' + aoData[48].value + '", echo: ' + aoData[0].value + ' }';

                contentType: 'application/json',
                dataType: 'json',
                error: ajaxError,
                type: "POST",
                url: sSource,
                data: jsonIn,
                success: function (msg) {

The ajax call is to an ASP.NET Web Service (.asmx) so the data needs to be sent as text.
fnCallback is the rendering function for the datatables plugin. The plugin requires the construct passed in to have the following properties:

  • sEcho
  • iTotalRecords
  • iTotalDisplayRecords
  • sColumns (optional)
  • aaData

Following Zack Owens’s advice, I created a server side class that wraps my web service’s response. The properties correspond to the data contract that this plugin expects. For the sEcho property, needs to be populated with the same value that is passed to the fnServerData handler via aoData[0].value otherwise your data table will experience any number of issues re-rendering when you sort or change pages.

    public class FormatedList
        public FormatedList()
        public int sEcho { get; set; }
        public int iTotalRecords { get; set; }
        public int iTotalDisplayRecords { get; set; }
        public List aaData { get; set; }
        public string sColumns { get; set; }
        public void Import(string[] properties)
            sColumns = string.Empty;
            for (int i = 0; i < properties.Length; i++)
                sColumns += properties[i];
                if (i < properties.Length - 1)
                    sColumns += ",";

IIS Express

Web development on the Microsoft platform has always had its hurdles. With Windows XP, your development environment would use IIS 5 where as the server that would host the production site would be IIS 6. Additionally, there was the issue where we were limited to a single website running on that machine (this was a pain when working on multiple projects at the same time).

Microsoft’s virtual web server that would get kicked off by Visual Studi0 (Casini) alleviated some of the hardships by allowing each one of your web projects to run on an individual site. With the release of IIS 7, and particularly the rewrite rules that they provided, we ran into another issue where our production environments supported rest-full, SEO friendly URLs but the virtual web servers initiated by Visual Studio would not be able to process the URLs.

Recently, Microsoft addressed many of these issue with IIS Express. Scott Guthrie blogs about this new tool here:

jquery, ajax, and .NET Web Services

Recently, I have been working on a few projects that require an ajax friendly life cycle for an ASP.NET web application. Much of the work I did is based on Rick Strahl’s post:

Working on top of what I learned from this article, I decided to leverage the rich capabilities of .NET’s Web UI components as part of my ajax implementation using HTML injection. I used jquery to bind a standard button to make a call to my Web Service method.

The service created and populated a standard GridView object. The service would then render that object and return the HTML that was generated. This HTML, once returned by the service call, would be injected into a DIV tag that served as the container for the results table.

My initial implementation is a naive solution that renders full HTML on the server side and passes that back to the client-side. My ASP.NET page already has a script manager so I added a reference to my web service (simple .asmx in this scenario).

My service defines a method Foo:

namespace Client.Project.Services
/// Summary description for ConceptServices
[WebService(Namespace = “”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, Name = “MyBinding”)]
public class ConceptServices : System.Web.Services.WebService
public String Foo()
return “Hello World!”;

To make a call to this method via client-side javascript, simple use the fully qualified name for the method:
Client.Project.Services.Foo( successMethod, failureMethod )
Assuming Foo is overloaded to take in parameters, you would pass in those parameters first:

var i = 3
var s = “bar”
Client.Project.Services.Foo( i, s, successMethod, failureMethod );
function successMethod( o ){
//o is the value returned by the web service call

Continuous Integration with Cruise Control, .NET (C#, WPF, ASP.NET) Projects, and NAnt

UPDATE: NAnt 0.91 Alpha 2 has been released with support for .NET 4. Download it here.
UPDATE: CruiseControl.NET 1.5 (Final) has been released and is available here.
UPDATE CruiseControl.NET 1.5 RC1 has been released and is available here.

My Cruise Control .NET implementation consists of numerous development projects each with multiple different Cruise Control .NET projects associated with it (one per environment per branch). In order to make the projects more maintainable, I have created a separate configuration file for each development project. Defining variables and separating ccnet.config configuration file into smaller files allows for easier maintenance of each project over their lifetimes.

Defining and using variables

Variables can be defined using the following format

<cb:define KEY=”VALUE” />

To reference that variable later in the configuration file, simply use $(KEY)

Check out the Cruise Control .NET website for complete explanation of variables using the pre-processor.

Separating the configuration files

<!DOCTYPE cruisecontrol [
<!ENTITY PROJECT_NAME SYSTEM “file:project.xml“>
<cruisecontrol xmlns:cb=”urn:ccnet.config.builder”>

project.xml would, then, contain the regular xml configuration for a Cruise Control .NET project:

<?xml version=”1.0″ encoding=”utf-8″?>
<project name=”My Project” category=”A Category”>
<intervalTrigger seconds=”900″ buildCondition=”IfModificationExists” />
<scheduleTrigger time=”04:00″ buildCondition=”ForceBuild” />
<labeller type=”svnRevisionLabeller”>
<pattern>Version {major}.{minor}.{build}.{revision}</pattern>
<sourcecontrol type=”svn”>
<cb:SvnOptions />
<xmllogger />
<cb:include href=”EmailConfig.xml”/>

On caveat with this idea is that changes to the separate configuration files are not recognized until the cruise control is restarted by either restarting the service or modifying the ccnet.config file.

Building and Deploying ASP.NET Web Applications

The NAnt target below is a full parameterized call to MsBuild.exe to compile any solution. ThoughtWorks.CruiseControl.MsBuild.dll provides an MSBuild logger that allows Cruise Control .NET to report the bulid output.

<target name=”build”>
<exec program=”${MSBuildPath}”>
<arg line='”${SolutionFile}”‘ />
<arg line=”/property:Configuration=${SolutionConfiguration}” />
<arg value=”/target:Rebuild” />
<arg value=”/verbosity:normal” />
<arg value=”/nologo” />
<arg line=’/logger:”C:Program FilesCruiseControl.NETserverThoughtWorks.CruiseControl.MsBuild.dll”‘/>


MSBuildPath – The path to the MsBuild executable.

For .NET Framework versions 2.0 and 3.5  on a 32-bit Windows OS, use C:WINDOWSMicrosoft.NETFrameworkv2.0.50727MsBuild.exe
For .NET Framework version 4.0, use C:WINDOWSMicrosoft.NETFrameworkv4.0.30319MsBuild.exe

SolutionFile – The relative path from the build file to the solution file. Fully qualified paths are also allowed.

SolutionConfiguration – “Release” or “Debug”.

I have been working on a website to aggregate funny technology related content across the internet. So far, I have been able to integrate pictures, YouTube videos, and some RSS content from fmylife and clientcopia

I have created the site using ASP.NET and SQL Server. I made this decision solely because I use Microsoft’s platform every day for my professional work.

Picture Uploads and Thumbnails

The pictures page ( allows visitors to add their own pictures. Upon uploading a picture, a thumbnail is also generate for that picture. The code below shows how to create a thumbnail of an uploaded image.

public System.Drawing.Image CreateThumbnail(System.Drawing.Image original, int width, int height)
return original.GetThumbnailImage(width, height, null, new IntPtr());

Ajax using jquery + .NET Web Services

Recently, I have also been introducing some new ajax functionality using jquery and .NET web services. This combination has allowed me to easily introduce a “preview” feature for uploading images and YouTube videos.

Content Management

Youtube Videos

The site is being updated to use the Youtube play list as the content manager for the videos page. Comments and ratings will be retrieved for the detail page and visitors to can add their own comments and ratings.

Adventures in WCF (Windows Communication Foundation)

My latest project at work has me working with WCF for the first time and it has been an interesting experience. Over the next few weeks, I will be discussing configuration, debugging, and deployment of the WCF service and connecting to it.

Microsoft provides a few tools that can help debug your WCF services.

Error Handling

Typically, I add Global.asax to a web application in ASP.NET and use the Application_Error event to handle any uncaught exceptions.

protected void Application_Error(object sender, EventArgs e)
//Insert your application’s exception logging here

This doesn’t work (still looking into why) for WCF services, even when hosted on IIS. A good work around is to wrap each service method with a try…catch block and calling the exception logger in the catch block.

public Object MyWcfWrapperMethod( int i )
//Call the method being exposed by WCF
catch( Exception e ){
//Log the exception
//do your clean up here


Unit tests are especially helpful (aren’t they always?) in the development of your WCF services as messages from errror and exceptions can (and will) be hidden by subsequent errors. An invalid parameter to a stored procedure call can result in a high level System.ServiceModel.CommunicationObjectFaultedException.