Blazor and .NET Core hosting – the future’s bright

In a past life, I was a web developer. In this post, I’d like to take an outsiders perspective on a couple of developments that I think will be hugely disruptive in the coming years. The first of these is .NET Core making it possible to run .NET websites on cheap hosting. The second is Blazor, which promises to let us use .NET for front-end web scripting – replacing Javascript. This post is a bit more soapbox-y than usual, so bear with me!

My web development journey

My web design company’s website, circa 2008

I started making websites around the turn of the millennium when I was a teenager. I think the first website I was paid to create (and be a “webmaster” for) was for the pre-school in my village. If memory serves, I started out using Microsoft FrontPage and graduated onto Dreamweaver (almost certainly a cracked version – sorry Macromedia!). The web was simpler back – this was a time before Single Page Applications or even AJAX.

I kept developing websites on and off for about a decade. For a time, I leapt on all the cool new things. When WordPress was still tiny, I got stuck in. When Facebook apps were first announced, the company I co-founded were among the first to develop them commercially.

Since 2009, my work has taken me away from the world of web development, as I’ve focused more on desktop and back-end stuff. I’ve been primarily using C# and .NET to build stuff in a Windows context.

Now, looking at web development again, it is barely recognisable to me. Javascript used to be used a few lines at a time to make cool effects happen. Then we had what I think of as the jQuery era, which made richer interactions possible. Fundamentally though, Javascript was for the front-end; it was the final layer on the stack that we used for enhancements. Today, it seems as though Javascript is web development. Between node.js and the whack-a-mole framework ecosystem, there’s no escaping Javascript in the new web.

Without wanting this to degrade into an attack on Javascript and its ecosystem, let’s just say that I’m not a huge fan. Sure, I can use it to get a job done, but it leaves me feeling uneasy.

Instead (for a variety of reasons) I prefer writing code that targets .NET. This historically hasn’t been very easy on the web, which is why I’m so excited about a couple of recent developments.

ASP.NET Core on bargain-basement hosting

One of the problems with using .NET historically has been the tight link with Windows. Hosting a website on a Windows server is always going to be more expensive than a Linux server, because of licensing costs. This has tended to put people off writing web applications in C#, even considering how good the ASP.NET MVC framework is. I’m no exception: for personal projects, I’ll tend to revert to PHP.

Microsoft’s recent overtures towards open source mean we may soon see this changing. In particular, the launch of .NET Core in 2016 and ASP.NET Core in 2017 have allowed developers to ditch IIS and run C# websites on Linux servers.

This is great news for the web in general, but what’s got me excited is a crazy experiment by Scott Hanselman: Running ASP.NET Core on $3/mo GoDaddy hosting. Straight. Up. Bonkers.

It is super janky and requires a cron to keep it running, as well as a PHP proxy to actually listen on port 80, but it works! Yes, there’s plenty of spit-and-sawdust, but none of it is against any terms of service, or outside of licensing.

Fundamentally, ASP.NET MVC is running on the same stack as PHP. And that’s a big deal. It shows how close we are to being able to throw .NET code onto commodity shared hosting. This removes a fairly significant barrier for lots of developers, who perhaps won’t now be tempted by the evils of PHP.

.NET for the front-end – Blazor!

One of the interesting trends in web development has been the advances Javascript has made into the backend. “If you’re using JS in the frontend” – goes the reasoning – “you may as well use it for the backend too.” Cue projects like node.js.

This logic cuts both ways, though: if I’m writing the backend in C#, why would I want to switch to JS for the frontend? Until recently I wouldn’t have had a lot of choice. So what’s changed?

The maturation of the Web Assembly project means that we can now harness the browser’s (highly optimised) Javascript VM to run code compiled from pretty much any language. The nice chaps at Xamarin have been beavering away, persuading the Mono .NET runtime to run on Web Assembly.

The result is Blazor – an experimental web frontend framework written in C#.

There are a few videos out there showing this in action. They’re mostly on the long side, but well worth it. Perhaps the best one to go for is this segment from Steve Sanderson’s talk from NDC Oslo last year:

I really like the fact that I’ll soon be able to use C# to write frontend code for my websites, but what I love is how we got here. This is the beautiful convergence of web standards and a more open .NET.

What does it all mean?

Frank Chimero has recently blogged about how alien HTML/CSS styling and layout techniques have become in recent years: Everything Easy is Hard Again. I have been feeling similarly about the web application development landscape. The plethora of Javascript frameworks, untameable dependency chains and incomprehensible toolchains… Sheesh.

But these two innovations give me hope. Having the flexibility to code the whole stack in C# is going to be so refreshing. And to be able to bung the whole lot onto cheap commodity hosting will be a bit of a breakthrough.

For me, these two advances represent the latest fruits of Microsoft’s efforts to open up the .NET ecosystem. I could not have imagined that either of these things would have been possible if you’d asked me three years ago. Now though, .NET Core is clearly here to stay and the result is that .NET is more accessible and relevant than ever.

For new developers fresh from school, the barriers to entry are coming down. Among seasoned .NET professionals, I’m sensing a renewed energy and optimism. It’s genuinely very exciting right now.

I’ve forked the Blazor project and am hoping to be able to throw together a quick ConTabs demo. You never know, by the time I’m ready to put it online, a host like GoDaddy may have started officially supporting ASP.NET on their cheap tiers.

What makes you excited to be a .NET developer? What are you hoping to do with a newly invigorated ecosystem? Let me know in the comments.


Leave a Reply