On to Linux – the land of unexplained instructions

In my quest to get an ASP.NET 5 (vNext) website running on a shared Linux hosting account, the first step was to get the site running locally on my Windows laptop. It proved a bit of a challenge as my VS2015 initially refused to run it in the debugger. Having solved that problem, the next step is to get the site running on a dedicated Linux server.

Right. Where do you get a dedicated Linux server? Without paying through your nose?

The Cloud!

Plenty of cloud providers around. Azure and Amazon to name two. And there are enough free plans available too. Even if they offer limited service, that should be enough for some experiments. After all, we are not aiming to put a site in production. Learning is what we want to do.

My Microsoft Partner Network Application Builder Action Pack subscription comes with MSDN subscriptions and as part of one of these two, I have get USD 50 (or is it 100 now?) Azure credit per month. Let’s get some use out of it.

Having absolutely zero knowledge of running Linux, I was stumped by the sheer number of Linux images that Azure offers. Which one to choose? No idea. The information Azure provides on the side of the list of available images is not much help if you have never dealt with Linux before. In the end I picked “Ubuntu Server 14.04 LTS”.

Why? No science to it really.

Ubuntu sounded familiar (as did Suse) and I have seen it mentioned in several blogs I read. The “Ubuntu Server is the world’s most popular Linux for cloud environments.” in the side information provided clinched the deal for Ubuntu and I selected the 14.04 version only because the date until which it gets updates and patches was the farthest into the future.

I chickened out of uploading a “compatible SSH key” for authentication. Looking at the information behind the “learn more” link, I decided I was not going to shave that Yak today.

The other steps for setting up my virtual dedicated Linux server were not too difficult. I basically entered some names and otherwise accepted the defaults. Hitting the submit button on the final step of Azure’s wizard led to the “Virtual Machines” showing my freshly minted VM getting into gear.

Ok. Cool. My Linux virtual machine is running!

Let’s charge ahead and install the .NET Execution Environment (DNX).

Uh? Oops? How do I install something on that Linux server?

In order to install anything on any machine, you need access to it. For a remote server, one that you cannot touch physically, you need to connect to it somehow so it is as if you are looking at its monitor and using its keyboard and mouse. Is a mouse even applicable on a Linux server? I guess only if you have a graphical user interface and by the looks of all the Linux related instructions I have ever encountered, being helped and prompted by a visual interface isn’t part of the deal. Bummer. A command line interface may be quick for experts, but having to remember all sorts of commands isn’t my idea of easy.

Anyways, first things first: connecting to the server.


The virtual machine I created on Azure comes with a “Quick Start” page. It gets displayed when you click on any virtual machine’s name, either in the list of virtual machines or in the list of connected instances of a cloud service. Unless, you check the box to skip it on your next visit. Yeah, right, that won’t happen any time soon. I’m lost enough as it is.

The Linux Virtual Machines: How to Guides, Common Tasks, Best Practices, and Partner Solutions has an enticing ring to it. It is some high level start page, but at least it has a frequently asked questions link in the left menu. Which in turn has a “How can I access my virtual machine” section with How to Log on to a Virtual Machine Running Linux.


Ok, so you need an SSH client. PuTTY was suggested and I wasn’t about to argue with any suggestions.

After installing PuTTY it should have been a breeze to log into the VM, but it wasn’t.

I had generated a password for my VM’s single user using LastPass. Normally a very good thing to do. After all it is an Internet facing machine. Except in this case it created all manner of trouble for me. I couldn’t find a way to paste stuff into the PuTTY window. I couldn’t see what characters I had already typed as the cursor doesn’t move and doesn’t show characters as you type a password. I made all the classic mistakes reading the characters and numbers: mistaking capital “o” for zero, 1 for l, etc.

Anyway, after much frustration trying to reset the password to something simpler – all attempts failing with very uninformative error messages – I finally got in using the original – typing it very carefully while reading it from an editor using a mono-spaced font with very distinctive numbers and characters.

Good. Now what?

Install DNX of course. And change the bl… password. I don’t want to have to enter an unintelligible 20 character password manually ever again.

Uh… Help?

Oh right, that actually might be a command! 😀 It is in Windows, so why not on Linux? Didn’t help much though in finding how to change my password. pwd sounded nice, but that is a command to print the current working directory. Not much use to me. Google was my friend though, so I did succeed in changing my password once I found the passwd command ( Linux Set or Change User Password ).

Gosh, I guess I am spoiled rotten, but really, I do not get anybody preferring a command line interface over a graphical one. Clicking around is soooooooo much easier to explore a new environment than typing commands and getting lost in a console window. Just try to figure out how to get back to a prompt after typing info. Argh!

Now that I have got that out of the way, though, let’s move straight on to installing DNX.

Installing DNX on Linux

IIRC the page that helped me get DNX up and running on my laptop also had a link for installing DNX on Linux. So let’s try and find that. Yep. Installing ASP.NET 5 On Linux. Very reassuring that the instructions were tested using Ubuntu 14.04! The exact version I just happened to pick out of my hat when selecting an image for the VM.

Getting your Linux system ready to run ASP.NET 5 applications, takes a couple of steps. You need Mono, Libuv, DNVM (hey, I recognize that from the Windows install).

Silly me started to type in the required commands manually. Got old very quickly. So, copied stuff to the clipboard dead set on finding a way to get PuTTY to paste it. Its system menu didn’t provide much help, but as luck would have it, just happened to right-clicking in the PuTTY window and that turned out to be the way to paste the clipboard contents. Heyho! Now that’s nice!

Installing Mono took quite some time, but went without a hitch. So onto Libuv.

I wonder if you can use the PuTTY trick to paste multiple commands and have them executed as a script? Let’s not jinx my progress just yet. I’ll do them one by one.

The mere thought of getting smart must have jinxed my progress. It stopped dead in its tracks at the sudo make command. That resulted in sudo: make: command not found.

Uh? What?

Obviously, my “Ubuntu Server 14.04 LTS” isn’t quite the same as the “Ubuntu 14.04″ that was used to test the instructions…

Boy do I hate that nobody ever bothers to explain the commands they say you need to execute! Like being blind and not even having a … stick!

How the heck I am supposed to solve that when nobody explains the instructions?! Ok, they do explain what and you need the various parts (Mono, Libuv and DNVM), but for some reason nobody ever takes the time to explain what the individual commands are meant to do and why you need them. Of course as a developer I understand what make would do, but for the life of me I don’t have a clue what sudo even is.

Some searching and learning needed to get past this little hurdle. Before I do …

Time to call it a night!

Posted in Learning

Fixing VS2015 when it doesn’t want to run an ASP.NET vNext website

The quest I announced earlier to get a bare bones ASP.NET 5 (aka vNext) website running on a shared Linux hosting account begins.

A couple of weeks ago, I already downloaded and installed Visual Studio 2015 RC and started it to have a look around. Since then only used it to create a couple of code examples while answering questions on the web. So this will be the first attempt at creating and running a web site.

Let’s dive in.

Fire up Visual Studio 2015 RC and create a new ASP.NET Web Application project. Make sure to target the 4.6 .NET framework and to select the ASP.NET 5 web site template. The check boxes to add extra folders, to add unit tests and to host the site in Azure are all disabled. Sure hope they are going to be available in the RTM (Release To Market) version, especially adding a unit tests project! After some heavy grinding (and “Not responding” caption additions) Visual Studio shows the new project.

Good. Optimist that I am, I press the “Start” button. And … hit a snag:

Debugger cannot continue running the process

Dismissing that bothersome dialog, I notice that even both “Start” options in the Debug menu are grayed out:

Both start buttons grayed out

What the …?
This wasn’t in the script!

Following the “Run your app locally” link in the list of articles on the Project’s readme page, I read through Your First ASP.NET 5 Application Using Visual Studio. Nothing jumps out to me. Even though I didn’t read it beforehand (how could I, didn’t know it existed until the project was created), I basically followed it to the “T” and for all I know, the project should simply run. So, what is going on here?

Let’s do a sanity check. I haven’t really used Visual Studio to execute anything yet since switching to my brand new shiny laptop. So, do any of the other web projects still run? Let’s check with Visual Studio 2013. After all, I used that successfully to create those other projects and even deployed them to Azure, so they should be good to go.

Yay. ASP.NET MVC web application created with VS2013 runs in VS2013.

With a website project in VS2013 the “Start” button reads “Google Chrome” (my default browser in VS), not “Start” as it just did in VS2015. Wonder whether that means something?

VS2013 toolbar with start button showing "Google Chrome"

First, let’s see whether I can run this web site from VS2015. Loading it in VS2015, signs are looking good, the “Start” button in VS2015 now also reads “Google Chrome”. And yes, indeed, I can start and run the project without problems.

VS2015 Start button now also reading "Google Chrome"

Soooo, if VS2015 can run an ASP.NET 4.5 website without a hitch, but refuses to start an ASP.NET 5 website, it must have something to do with running ASP.NET 5 projects specifically.

Running ~ execution, so the .NET Execution Environment (DNX) link in the menu on the left of Your First ASP.NET 5 Application Using Visual Studio could certainly be relevant.

That DNX overview gives a lot of information. More than I want to know at the moment. The link to Working with DNX Projects seems promising, but leads to a “this has not been written yet” page. Bummer. Fortunately, there is a Getting Started” link. Aaaall the way at the bottom…, but it is there at least!

Installing ASP.NET 5 On Windows on that Getting Started page, sounds exactly like what I need. It just really irks me no end that this wasn’t part of the Visual Studio 2015 RC installation! Ah, uh, I guess it actually was. According to the installation instructions it is part of the VS2015 install, provided you specify that you want to install the “Microsoft Web Developer Tools”. Did I miss that? And if I did, why isn’t it checked by default?

Anyway, that is easy to fix, just modify the installation, right?

Uh, not so fast. Selecting Visual Studio 2015 in the “Programs and Features” part of the Control Panel and clicking “Change” brings up the installation dialog. With “Web Developer Tools” selected?! And the “Update” button is grayed out?

VS2015 "Modify" Installation dialog

Huh? It was installed? Then what is wrong with it?

According to the “manual installation” instructions (on the Installing ASP.NET 5 On Windows page), installing DNX requires installing the .NET Version Manager (DNVM) first. If it is installed, it should be possible to run “dnvm” from a command prompt (with administrator privileges) and get an intelligent response.

DNVM command output

Well … that part works.

To install DNX the instruction say to run “dnvm upgrade” and then “dnx” to check that it was configured correctly. Jumping the gun a bit I just ran “dnx”. And indeed, my poor Windows has no clue.

Windows has no clue about dnx command

Running “dnvm upgrade” goes without a hitch. And running “dnx” no longer produces blatant ignorance, but tells me what it is prepared to be told to do, i.e. lists the commands it knows about.

Curiously, neither the DNVM nor the DNX can be found anywhere in the “Programs and Features” part of the Control Panel. However, there is a “Microsoft DNX” folder in “Program Files”. Ah well, Windows runs in mysterious ways, I guess.

Back to where I was. Trying to run a newly minted ASP.NET 5 web site. Aka an ASP.NET vNext website. Firing up VS2015 RC and reloading the project, immediately makes it obvious something has changed. The “Start” button now reads “IIS Express”.

VS2015 Start button reading "IIS Express" for ASP.NET vNext website project

Let’s click it.

Yay! Success! It opens in my browser.

BareBones website showing in Google Chrome

But hang on, how do I know it is actually using DNX? The fact that it didn’t refuse to run is a clue, of course. As is the fact that the Task Manager shows there is a dnx.exe running. Cool. But… that could be from running “dnx” from the command prompt just now. The output log in Visual Studio brings certainty. It shows all manner of things being loaded from “C:\Users\marjan.dnx\packages\”, where DNVM just installed DNX.

Output log showing that it is loading dnx  packages


Stay tuned for the next steps in the quest to get the BareBones site running on shared Linux hosting account.

If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , , ,

Yay! ASP.NET 5 Runs cross-platform

Yay! Finally!

Ever since I started dabbling in running my own web sites, I have been wanting to be able to develop in a familiar environment (Delphi, C#, Visual Basic, VBScript) without having to shell out for a dedicated web server. GoDaddy‘s shared Windows hosting has been good for that.

Recently I migrated my multi-domain Windows hosting account to Linux because running a couple of WordPress sites on a Windows server, while it can be done – I have for years -, it ain’t much fun. The sites regularly returned “503 service unavailable” responses because resources were not being released properly by one or more plugins. Easily fixed, you just need to recycle your site’s application pool, it finally got very, very old to do so.

Migrating to a multi-domain Linux hosting account left me somewhat stranded for my hobby projects. Could of course use the Azure credits that come with my Microsoft Partner Network Application Builder Action Pack subscription. Deployment is even integrated into Visual Studio, making it very easy to throw something together and test it out in the wild.

Still, I don’t much like automated stuff when I don’t understand what’s going on and what steps are involved if you had to do it manually. Call me crazy, but ever since I started in software development I generally want to understand and do something myself, manually, before using a tool. It satisfies my endless curiosity.

So, I’ll be delving into what it takes to benefit from the “Runs cross-platform on Windows, Mac and Linux” feature of ASP.NET 5.

The goal:

  • A simple bare bones ASP.NET 5 MVC site running on a shared Linux hosting account.
  • Cheat sheet for creating such a beast at any time in the future.

Should not be too hard. I just am not entirely sure the “shared” part is achievable. We’ll see how it pans out over the next couple of posts.

Posted in Learning
Tags: , ,


A couple of weeks ago I was looking for information on burnout for a friend. I was convinced she was burned out. She denied. Obviously, I wasn’t going to convince her. Figured that I would dig up some articles so she didn’t have to take my word for it.

Boy, was I in for a shock.

First article I found had a bulleted list of symptoms. Reading through it, I got more and more upset. By the end of the list, I was dumbstruck. This couldn’t be. This was nonsense. I wasn’t burned out. I didn’t have time to be burned out. Not now. Not when I was finally seeing some movement towards all the things I had been advocating for two years.

But … this article was from … non other than the Mayo clinic.

Still, I didn’t care. I wasn’t going to let anybody tell me that I was burned out, not even the Mayo clinic. And I was going to prove them wrong!

Ya. Well. Not quite.

Every article I dug up, every checklist I read, hell bent as I was on proving that I was not burned out, only made it more clear that I was as burned out as they come. There was no way around it anymore. Two thirds to all items of every single checklist I found, applied to me.

Sh… ikes

No! It can’t be. Please, no.

I didn’t want to admit what was staring me in the face. Yearned for a blue pill. Yearned to go back to blissful ignorance.

While I may be headstrong and opinionated, I am not pigheaded. So, I arranged for several tests. When the results came back, they didn’t exactly surprise me anymore, but swallowing that red pill and facing the harsh reality certainly didn’t taste sweet.

Why didn’t I and do I still not I want to have to admit to being burned out? I am after all finally getting the rest I have longing to get for months?

Because… it feels like defeat.
Because… it feels like weakness.
Because… it feels like inadequacy.

I know all that is nonsense.

Burnout is not for the weak.

Burnout is for people who care too much. Who go the extra mile too often. Who drop on the job. Who neglect themselves in favor of others. Who don’t recognize what their bodies are telling them.

At the same time I didn’t want to be burned out, I was also very much relieved that I was “only” burnout.

‘scuse me, how’s that?

Well, this burnout has been two to three years in the making. All that time I have ascribed whatever symptoms I had, the behavior I displayed and the thoughts I had, to a whole slew of other causes. To “Alzheimer Light” (I don’t mean to belittle Alzheimer patients! It’s an awful disease and I feel for anybody suffering from it and for everybody caring for someone suffering from it. It’s a term we use in my family as shorthand for everything that has analogies with the onset of dementia.) To “old age” and “failing faculties”. To menopause (oh, do I envy you boys sometimes!). To the post traumatic stress disorder I suffered last year as a result of a car crash. To laziness. To simply not being up to my job anymore. To migraine upon migraine upon migraine. To apparently not being or no longer being the kind of person I always thought I was.

Burnout is no fun at all. But in comparison, burnout is a whole lot less awful. It isn’t progressive or permanent. It can be dealt with. It is treatable. And it can be prevented from occurring again.

So yes, relief.

It is still going to take quite some time to recover and hard work to prevent it recurring. On average the whole process takes three to six months.


But oversee-able.


The word burnout has been used and abused extensively. It has come to the stage where people call themselves and are called burned out when “all” they are is “just” overworked or overwrought.

This is unfortunate for those genuinely burned out, as they get a lot of flack. “Oh, you just don’t like your job. Buckle down and get on with it.”

A situation that is not helped much by the fact that burnout is not recognized as such in the DSM-5, which categorizes the symptoms as an adjustment or somatoform disorder.

While burnout is used to label anything and everything in day-to-day life, burnout is actually something very, very specific. The guidelines that physicians (general practitioners) and company doctors in the Netherlands have to follow, spell out a very specific set of criteria for a burnout diagnosis.

There are also several tests anyone suspected of burnout should take to ascertain whether they are and/or whether other disorders are at play. It is very important to differentiate them, because while burnout can lead to depression, any depression needs to be resolved before the burnout can be dealt with.


The Mayo clinic article:
Job burnout: How to spot it and take action

Differentiating burnout from depression:
Burnout vs. MDD (Major Depressive Disorder) differential analysis for diagnosis and therapy – using 15 differential symptoms

Tests dealing with burnout:

  • the 4DKL which determines Distress, Depression, Fear and Somatisation
    (note: I have only been able to find material about it in Dutch)
  • the MBI (Maslach Burnout Inventory) or the UBOS (Utrecht Burnout Scale) (a variant of the MBI), which determines the level of burnout (and distinguishes from depression).
  • the SCL-90 (Symptom Checklist 90) which assesses nine symptoms of psychopathology and provides three global distress indices.

Other resources I have found helpful:

Posted in Personal

Making sure all IWorker implementers call CanHandle from Handle without a mocking framework


You have an interface that allows you to treat all worker classes – classes that handle a specific type of work – as just one type: IWorker;

    interface IWorker
        public Boolean CanHandle(IWork work);
        public void Handle(IWork work);

You want your worker classes to be able to do their work without having to check their backs every step of the way.


You have no way of guaranteeing that the classes that are handing out work to workers call Handle only if CanHandle returns true.

This may be a bit of a contrived example, as in this case you’d probably be better off avoiding the problem altogether. But for the sake of argument let’s say that is not an option and that the calling `CanHandle` from `Handle` is just an example of you needing to make sure that the implementer of one method always calls another and and acts according to the returned value.

To make every worker call CanHandle itself and only proceed with the actual work if everything is ok, you could of course provide a base class that does this. Ensuring with tests that the base class sticks to the pattern of calling CanHandle from Handle would be easy to do. And it would allow specific workers to focus on their own specific processing.

Hang on though … having such a base class kinda defeats the object of having an interface: not tying yourself to a distinct class hierarchy.

So how can you ensure that every class that implements the IWorker interface has implemented its Handle method in a way that protects the actual processing code from being handed cows when it is designed to handle chickens? Working out that you ended up with a sliced and diced pair of jeans because some distributor blindly handed your Levi’s to a kitchen worker instead of a laundry worker, is not exactly fun or easy.

The way to protect yourself from late night debugging sessions has three parts:

  • You need a way to test every class implementing IWorker with the same set of tests.
  • You need a way to substitute the actual implementation of CanHandle with an implementation that does exactly what your tests need it to do.
  • You need two tests to verify that Handle calls CanHandle and proceeds in accordance with what CanHandle returns.

1. Executing the same tests for every class implementing IWorker

Ensuring that every implementer of IWorker is tested with the same set of tests, is pretty simple when you are using NUnit and not much more difficult when using MSTest (just a little more work).

When using NUnit this boils down to using a generic test class and using the TestFixture attribute to specify the classes to be tested.

    class IWorker_ContractTests<T> where T : IWorker, new()
        IWorker MakeWorker()
            return new T();

        public void TestMethod1()
            IWorker worker = MakeWorker();
            // ...snip...

For more information check out these two posts:

2. Substituting CanHandle

To verify that Handle acts according to what CanHandle returns, you need to be able to control what CanHandle returns. This means you need to substitute the actual implementation of CanHandle with whatever your tests needs it to do.

Using a mocking framework that is a piece of cake. But what if you can’t use a mocking framework?


Yup. Without a mocking framework you are definitely in a bit of a pickle.


When dealing with interfaces, you always have the option of wrapping the implementing class that you want to test in a “Test wrapper” and selectively delegate its methods to the “actual” implementer. Something like this.

    class TestWrapper : IWorker
        IWorker _WorkerUnderTest;
        EnsureCanHandle _ReturnsThis;

        public TestWrapper(IWorker workerUnderTest, EnsureCanHandle returnsThis)
            _WorkerUnderTest = workerUnderTest;
            _ReturnsThis = returnsThis;

        public Boolean CanHandle(IWork work)
            return (_ReturnsThis == EnsureCanHandle.ReturnsTrue);

        public void Handle(IWork work)

    enum EnsureCanHandle

The test wrapper in this example takes the actual worker to be tested as the first parameter of its constructor. The second parameter dictates the result that CanHandle will return. The test wrapper’s implementation of CanHandle does what is required by the test, while its implementation of Handle delegates to the actual worker.

3. Testing Handle

You want all classes implementing IWorker to call CanHandle from Handle. And you only want Handle to proceed with the actual work when CanHandle returns true. When CanHandle returns false, Handle should throw an IndecentProposalError.

To achieve this using our test wrapper, you need to tweak the MakeWorker helper method of the generic test class to take a parameter that will dictate the result CanHandle returns. And of course you need to pass the desired CanHandle result in each of your tests. After that, all that’s left to do is to write the actual tests.

Like so.

    class IWorker_ContractTests<T> where T : IWorker, new()
        IWorker MakeWorker(EnsureCanHandle returnsThis)

            return new TestWrapper(new T(), returnsThis);

        public void Handle_CanHandle_Returns_False_Should_Throw_IndecentProposalError()
            IWorker worker = MakeWorker(EnsureCanHandle.ReturnsFalse);
            IWork work = new Work_Fake();


        public void Handle_CanHandle_Returns_True_Should_Not_Throw_Anything()
            IWorker worker = MakeWorker(EnsureCanHandle.ReturnsTrue);
            IWork work = new Work_Fake();


That’s it. That’s how you make sure all classes implementing IWorker call CanHandle from Handle and proceed appropriately when you can’t use a mocking framework. Enjoy!

What code had you wondering how to test it? I’d love hearing from you by email or in the comments below. I read everything and will try to help where and as best I can.

Posted in Unit Testing
Tags: , , , , , , , , , , , ,

Don't want to miss out?

Subscribe now and receive a regular influx of practical information on ASP.NET vNext, unit testing and software design.
* = required field