Friday, October 28, 2016

Over-Engineering: The curse of a software architect

We as software developers love technology, especially new and shiny stuff. When it comes to building software we always want to play with the latest tool, technology and architecture of the day. And for a part that’s OK, as it drives innovation and creates new opportunities but for a part it is not as we have a tendency to over-engineer and try to stuff as many of these new and shiny things into our pour software projects.


“Don’t over-engineer” is a golden rule that we all should apply.


A great post that perfectly relates to this sentiment is “10 Modern Software Over-Engineering Mistakes”, a must read!

Thursday, October 27, 2016

Get a headstart when building ASP.NET Core+Angular 2 applications

If you already tried to create your first Angular 2 application, you probably had the same experience as I had. It takes a lot of time before all building blocks, configuration settings, npm packages, webpack, system.js,… is finally configured in a way that works. Once you’ve passed this initial roadblock, you are good to go, but it will take some time to get there…

Luckily Mads Kristensen, the guy who brought us the great Web Essentials extensions for Visual Studio, created the ASP.NET Core Template Pack. It is a collection of project templates that makes it easy to learn how to use ASP.NET Core.

Among the templates you can find one specific for ASP.NET Core and Angular 2.

Let’s try it!

  • Download and install the ASP.NET Core Template Pack either from the Visual Studio Gallery or through the Extensions and Updates… inside Visual Studio.
  • Open Visual Studio. Go to File –> New Project.


  • Go to the Web section inside the Templates. Choose ASP.NET Core Angular 2 Starter Application from the list of templates. Click OK.


  • 10 seconds later, we have our preconfigured Angular 2 application ready to roll! No time lost, trying to understand which packages are required or to how to configure webpack.


  • And if we run it we see that we get some extra goodies:
    • Server-side prerendering. For faster initial loading and improved SEO, your Angular 2 app is prerendered on the server. The resulting HTML is then transferred to the browser where a client-side copy of the app takes over.
    • Webpack dev middleware. In development mode, there's no need to run the webpack build tool. Your client-side resources are dynamically built on demand. Updates are available as soon as you modify any file.
    • Hot module replacement. In development mode, you don't even need to reload the page after making most changes. Within seconds of saving changes to files, your Angular 2 app will be rebuilt and a new instance injected is into the page.
    • Efficient production builds. In production mode, development-time features are disabled, and the webpack build tool produces minified static CSS and JavaScript files.



Wednesday, October 26, 2016

ASP.NET MVC–WIF authentication pipeline is not invoked

After configuring my ASP.NET MVC application to use WSFederation with WIF, I was finally ready to run the app the first time. However instead of redirecting me to the configured STS and showing me a login page I ended up with a 401 Unauthorized error page.

I first thought that the required HTTP modules were missing, but no they were there:

Let’s have a look at the WIF configuration:

There is definetely something wrong here, but I had a hard time figuring out what. The problem is related to the passiveRedirectEnabled configuration setting. If you set passiveRedirectEnabled to false, WIF will no longer be responsible for the redirections to your issuers.

That explained a lot! Switching the setting to true solved my issue and I was finally welcomed by my STS login page…

Tuesday, October 25, 2016

WIF error: ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry.

I’m currently working on a training for one of my customers covering WIF(Windows Identity Foundation),  OIDC(Open ID Connect) and some other security related topics on top of the .NET stack.

Yesterday I got a strange problem after configuring the MVC application that should act as the relying party.

Here is the WIF specific configuration:

And here is the error I got when I ran the application:

ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry. To accept security tokens from this issuer, configure the IssuerNameRegistry to return a valid name for this issuer.

I compared the thumbprint of the certificate used by the STS with the thumbprint inside the config:

         <add thumbprint="6b 7a cc 52 03 05 bf db 4f 72 52 da eb 21 77 cc 09 1f aa e1" />


No matter how much I looked, I couldn’t see a difference.

Time to ask the global web for help. After some research I found the following article:

It seems there is a bug in the Richedit control that is used by the Certificate UI. When you copy the thumbprint, an extra (invisible) unicode character is being copied also. And indeed when I typed it in instead of copying it over, the error disappeared… Confused smile

Monday, October 24, 2016

VSTS: Monitor usage

Last week I discovered a new tab inside VSTS; the Usage tab.


The Usage tab shows the request history of the users ordered by usage( based on Team Services Throughput Units  or TSTUs). By default, visiting the Usage page will display requests for the last hour.


Another nice feature is that you can review the request history leading up to delayed requests.


Friday, October 21, 2016

Xamarin.Forms: INSTALL_FAILED_UPDATE_INCOMPATIBLE when trying to deploy to Android device

When we tried to deploy a Xamarin Forms app to an Android device, we got the following error:

InternalError ---> Mono.AndroidTools.InstallFailedException: Failure
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass2a.<InstallPackage>b__29(Task`1 t)
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at Xamarin.AndroidTools.AndroidDeploySession.RunLogged(CancellationToken token)
at Xamarin.AndroidTools.AndroidDeploySession.Start(CancellationToken token)

The problem seemed to be that a "ghost" copy of the app still existed on the device although there was no app icon. However when searching under Applications we found it with its package name instead.

After uninstalling the package we were able to deploy the new version…

Thursday, October 20, 2016

The Open Guide to Amazon Webservices

I hear people talk about JavaScript fatigue, the constant churn of new frameworks, tools and libraries in the JavaScript ecosystem makes it difficult to keep up. I must say that I have the same feelings regarding Cloud, every week Microsoft, Google or Amazon announce a new PaaS, SaaS, FaaS,… offering.

A great resource to help you understand what’s going on inside the Amazon cloud space, is the Open Guide to Amazon Webservices.

From the github page:

A lot of information on AWS is already written. Most people learn AWS by reading a blog or a “getting started guide” and referring to the standard AWS references. Nonetheless, trustworthy and practical information and recommendations aren’t easy to come by. AWS’s own documentation is a great but sprawling resource few have time to read fully, and it doesn’t include anything but official facts, so omits experiences of engineers. The information in blogs or Stack Overflow is also not consistently up to date.

This guide is by and for engineers who use AWS. It aims to be a useful, living reference that consolidates links, tips, gotchas, and best practices. It arose from discussion and editing over beers by several engineers who have used AWS extensively.