My home server BLEW UP and I have been down for a week. I did not want to loose my head along with my server so I took my sweet time to relaunch in style. I'm baaack. So much better site. There are a few more things to fix before done. So far so good. Take a look:

It’s alive! My site is Baack!

I’ve been running a server in my closet at home for years and years. Plus I have a 1GB Internet connection to my home (yes really). I have never felt the need to host outside of my closet. Yes – I’ve been closet hosting. Deep dark secret for a Windows Azure MVP. When my server went down so did the sites on it. My domain magnusmartensson.com went down as well. First I panicked. I have not been offline since… well… ever basically. After a while I calmed down and analyzed the situation: So I’m down. Big deal? What do I need to set it back up? Instead of loosing my head along with my server I set about fixing the problem. Here is my resurrection story!

Choose a Blog Engine

Over the years I’ve been using several blog engines. Way back when I hosted my blog at blog.noop.se but have subsequently moved to the more pro-league “ego site” magnusmartensson.com. This is now the fourth blog engine I’ve tried out. Always I’ve found each engine lacking in one way or another. You might think; well why not just sign up for a WordPress account or something? Well. That depends on how much ownership you want over your content. Scott Hanselman has put those thoughts down really well here: Your words are wasted

There are certain things that I’ve learned that I want from my blog engine if it’s going to suit my rather picky needs. Here are my criteria for a GOOD blog engine:

  • The source code – baby! I’m a developer and I want the source to the blog engine that I’m going to use so I’m able to go into the code and ‘fix’ stuff to my liking. Sure this is an extreme criteria 99.9995% of all bloggers out there would NOT care about this. I do.
  • Open source with an active community and current code base. This is more obscure. What I mean is that Open Source to the code of the blog engine ensures I can get it, tweak it, and reuse it anyway I please. An active community to push the engine forward is also pretty nice. You can get help if you get into a pickle and the engine probably will be pretty competent. That’s all good! The last part… current code base. I love the fact that I’ve found a blog engine that runs on ASP.NET MVC and that the code looks really easy to grasp when sifting through. I have already made several changes and it’s easy for me to find where to inject my code and personal ‘fixes’.

I found and fell for FunnelWeb blog engine which fills my basic criteria. There are more details on the features in that engine in the post below.

Given a good engine at the heart of things we can move on to:

Get full control of the blog entry addresses

Each blog engine has a Uri schema of it’s own. It can be with dates in the Uri and a nice pointless word like ‘archive’: weblogs.asp.net/scottgu/archive/2012/06/07/meet-the-new-windows-azure.aspx or with names of entries that are hard to read www.hanselman.com/blog/HelpYourUsersRecordAndReportBugsWithTheProblemStepsRecorder.aspx with an obscure number ayende.com/blog/159042/handling-entities-validations-in-ravendb or some other obscure number www.zdnet.com/microsoft-ceo-ballmer-devices-devices-devices-7000005507/. There are may formats. Each engine has it’s own ‘proprietary’ format. Some are good others are just really bad. Plus they all lock you in to using that particular blog engine for the rest of times.

My advice is this; Get an engine that will give you full control of the Uri for your posts. I have found one. When I write a post I can specify the Uri for the entry completely arbitrarily. It’s kind of like a wiki engine in that respect. This way I can use words in the entry Uri that are meaningful for the content. This will help with Search Engine Optimization SEO. Plus it ensures that you have not locked your self to one single engine. You control the Uris – you control the shape of your content.

With my new engine I can write “magnusmartensson.com/what /ever/uri-i-like” and that’s the Uri my page/blog entry will have. This is really cool and powerful.

‘Your’ brand matters

One itty bitty detail which is OH so important is that your readers will not generally surf to your site. At least your returning readers won’t. Searches will hit your site naturally and then, hopefully, you might get more new readers. Most of the reads you will get will be linked to your feed. The nature of your feed matters! I don’t mean weather it’s an Atom feed or an RSS feed. I mean, again, the Uri of your feed. Your domain is your brand and your feed needs to be your own property. This is the Uri subscribers will link to and if you some day want to change your feed.

Your feed can be someone elses: weblogs.asp.net/scottgu/rss.aspx – that’s not really good. The Gu does not own his feed. Asp.net does. Or you can use a super superior feed service like FeedBurner for your feed: feeds.feedburner.com/AyendeRahien but then FeedBurner owns your feed and also your subscribers. Or, actually Google owns them since they own FeedBurner. OR you can claim the uri to your own feed. That can be done using feedburner the right way with the ‘My Brand’ feature: feeds.hanselman.com/ScottHanselman.

The point is that Scott, and myself feeds.magnusmartensson.com/magnusmartensson, can do what ever we want with our feed should we ever want to change the hosting for it. I essence we can take five minutes and re-implement our feed using for instance SyndicationFeed and SyndicationItem and host that feed for free on Windows Azure Web Sites.

With the Blog Engine done, my blog entry Uris and feed Uri in check – what’s next? As you recall I said I have had several blog engines before and actually also several domains. I need some way to redirect old links to my new content format. Luckily there is a way to do that in the Internet Http Status Codes. No – not the I’m a teapot (Http 418) status. I’m talking about:

301 Moved Permanently

Google knows where my content is, or was. Bing knows where my content is, or was. My posts used to have the following Uri base: magnusmartensson.com/post/2012/09/29/CloudBurst2012-aftermath.aspx Now they have this kind of appearance: http://magnusmartensson.com/cloudburst2012-aftermath. The latter is so much nicer. Sure the Uri does not show the date. But do I really need that? And the .aspx extension that tells I’m hosted on an ASP.NET site – do I need that? No and no.

But wait: I have old Uris on the same site and I want to let humans and search engines know I have moved my stuff. Permanently.

Http response status code “301 Moved Permanently” is exactly what I need! :)

There are three things you need to do in order to redirect Uris on an ASP.NET MVC site to a new location:

1) Ignore the routes you don’t want your MVC engine to try to interpret.

2) Catch those same Uris in a custom HTTP Handler (by implementing the IHttpHandler interface.)

3) Redirect to the correct Uris using the 301 Moved Permanently Http Status Code in the response.

Here is how I did it:

1) Ignore:

I added this MVC .IgnoreRoute rule to my RouteCollection.

routes.IgnoreRoute("{*allaspx}", new { allaspx = @".*-.*\.aspx(/.*)?" });

This will catch all .aspx pages - my old addresses on my old blog.

2) Catch:

<system.webServer>
    <handlers>
        <remove name="BlockViewHandler" />
        <add name="BlockViewHandler" path="*.aspx" verb="*" preCondition="integratedMode" type="NoopMan.Aspx301Handler, NoopMan" />
    </handlers>
</system.webServer>

This simple trick will redirect all calls to .aspx to my custom handler, Aspx301Handler

3) Redirect using 301 Moved Permanently:

private static void Repond301(HttpContext context, Uri redirectionUri)
{
    context.Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
    context.Response.Headers.Add("Location", redirectionUri.AbsoluteUri);
    context.Response.ContentType = "text/html";
    context.Response.Write(string.Format("<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href=\"{0}\">/</a>.</p></body></html>", redirectionUri.AbsoluteUri));
    context.Response.End();
}

Finally, I have ignored the routes in MVC, I have caught the same routes in web.config and implemented my handler, now I can redirect properly using a standard 310 Moved Permanently response. When Google/Bing sees this they will update their entries and list my new Uris. If an old link leads to my old Uris they will be redirected by all browsers and land correctly on my new Uris.

Get better hosting: Enter Windows Azure Web Sites

Next step is to make sure the shameful single point of failure be eradicated for good! Enter Windows Azure Web Sites. With my domain now hosted in Windows Azure Web Sites I get:

  • Super easy and fast deployment using TFS (That’s Team Foundation Service not Team Foundation Server) of if I want with Git (or for that matter GitHub or CodePlex).
  • Resilience by the fact that if my hosting would ever go down, power outage in the Windows Azure Data Center node or human error or what ever, Windows Azure is smart enough to automatically stand up my service again.
  • Scaling – in my case down to a really cheap offering.
  • Custom ‘naked’ Domain Names: magnusmartensson.com
  • File stored redundantly and ‘for ever’ in a domain I control. (Read below.)
  • Full tooling support in my development IDE of choice Visual Studio.
  • Hosting for my SQL Data using Windows Azure SQL Database. Again resilient and redundant and frickin’ awesome! And I can manage this database service from inside SSMS.

Windows Azure Web Site for the engine

I host magnusmartensson.com on a Windows Azure Web Site. I use one single instance of size shared. Sure this means that I don’t have fail over. I can live with that small potential down time because it’s not a time critical high traffic blog. Sure this means my web site will be co-hosted with other web sites. Again I can live with it because it’s not a time critical high traffic blog.

magnusmartensson.com in the Windows Azure Web Sites management console.

Windows Azure Storage for your files

I have made a tweak to the MetaWebLog API implementation in FunnelWeb to map the upload Uris to my blog post media content to a custom domain name connected to a Windows Azure Storage Account so that my posts from Windows Live Writer will link media content properly. If you understand what I just wrote :) you know that’s really cool. If you don’t let me explain: I open up my blog post writer; Windows Live Writer, and write my blog post. I add images and other content to  the post in the editor. I hit publish. All my media content is uploaded and stored in Windows Azure Storage. The Uris returned use a custom domain name base for my file content. Look at where the images of this post are stored – they use files.magnusmartensson.com/site/ as a base. Before Live Writer commits my post to my domain it updates the Uris in the image tags in the post to reflect the correct location. Here is my storage account in Windows Azure: (Shown using Cloud Storage Studio from Cerebrata)

SNAGHTML8c8592

Windows Azure SQL Database for the data

FunnelWeb uses a SQL Database. I migrated it to a Windows Azure SQL Database. Here’s what it looks like to manage a WASD from the Windows Azure Portal.

SNAGHTMLb4f6f7

Hosting completeness

Using Windows Azure Web Sites, Storage and SQL Database for hosting my domain plays really well with my blog engine of choice and the technical setup I have selected and tweaked.

What’s next

Are we there yet? No.

I have only published the engine and configured it to work the way I like. I still need to

  • Migrate a lot of more data, files and blog entries, to my new domain. Right now I’ve only moved a few blog posts over. Many more, close to 300, to come.
  • Design the UI of my site.
  • Add some more pages to the site with information like an ‘About’ page and a contact page.

All of these things are not required to go live at this time. I will add it over the next few days to come.

Summary

So folks… I'm baaack! (Meaning my domain is back online.) It’s been a journey but I truly feel that I just took full control of my situation, that my domain is stronger than ever before, that I own and control my content and that the hosting of my content is über superior now compared to what it was before – thanks to Window Azure.

There are a more things to fix before I’m done and fully content. But now I feel I have a good start on a really nice blog engine and a great platform! My blog now has sharks with frickin’ lazers! Does yours?

Cheers,

Magnus

Posted by: Magnus Mårtensson
Last revised: 10 Oct, 2012 10:18 PM History

Comments

unlock huawei
unlock huawei
21 Feb, 2013 09:16 PM

I love #magnusmartensson.com dude, keep working

Unlock Huawei Express Unlock Huawei Ascend 2 Unlock Huawei Ascend

youtube converter
youtube converter
24 Feb, 2013 07:03 PM

I love #magnusmartensson.com buddy, keep working

Free youtube to mp3 download Free youtube mp3 downloader Best youtube to mp3

youtube software
youtube software
25 Feb, 2013 05:36 PM

I like #magnusmartensson.com buddy, keep it up to date

Youtube to mp3 converter download free Youtube to mp3 downloader free Youtube mp3 video converter

downloadnow
downloadnow
27 Feb, 2013 09:15 AM

Well done magnusmartensson.com owner http://www.pescaportal.it/index.php?option=comkunena&func=view&catid=19&id=42&Itemid=269 http://www.analistarodrigo.com.br/index.php/component/kunena/11-dicas/5-instalando-skype-no-fedora-x86-64.html http://evesync.com/index.php?option=comkunena&func=view&catid=2&id=3&Itemid=203

brietrips
brietrips
03 Mar, 2013 03:53 PM

Всем привет! Новинки мира apple ждут Вас на нашем сайте, заходите качайте, Всем бесплатно, много ссылок с разных файлобменников Игры ios

10 Mar, 2013 01:04 AM

On the contrary, Teddy Roosevelt said “Aggressive fighting for the right is the noblest sport the world affords.” Been there, done that.

bbwroomtumblr
bbwroomtumblr
22 Mar, 2013 09:54 AM

Are you seeking for BBW amateur pics this blog is the right place for you!

epicquotes
epicquotes
07 Apr, 2013 09:21 AM

magnusmartensson.com owner you are awsome writer Here you got some epic quotes tumblr for better humour

dariaddennA
dariaddennA
15 Apr, 2013 08:36 AM

kcyglyx グッチ バッグ afpqtio csycwht グッチ 財布 hpqeudc tkjnpov グッチ 財布 ounmkce yqmfvpy http://www.cheapguccijp2013.com/ vymzexu wtzlaze グッチ 財布 skunjww jfsrerl グッチ 長財布 lacqqpb zunwuip グッチ 財布 jjbbnzd oltuign http://www.gucciluxuryjp.com/ tprjfiq vlrduco グッチ アウトレット intwmwz ifnkixa グッチ バッグ dwztsrm ibmkqtj グッチ アウトレット vdjkizk izfbnio http://www.guccijust.com/ hluodrm cisgfec グッチ バッグ fittrav nmaneim グッチ バッグ mjkcenf jhdsqus グッチ バッグ uxxlhez vsitwjf http://www.annkaguccibuy.com/ gypevxh ossrfqy グッチ アウトレット zmxhlfp pczcylp グッチ 財布 sdscxad jupseka グッチ アウトレット rblrwcs ptwijyr http://www.yourguccijp.com/ gkghnsa

02 May, 2013 03:52 AM

There are several advantages of working from home on eBay. You can start up an in your own home business with very minor capital invested. Additionally you can work your own hours.

14 May, 2013 06:29 PM

Right now it seems like Movable Type is the preferred blogging platform out there right now. (from what I've read) Is that what you are using on your blog?

14 May, 2013 06:29 PM

Have you ever considered about adding a little bit more than just your articles? I mean, what you say is fundamental and all. However imagine if you added some great graphics or videos to give your posts more, "pop"! Your content is excellent but with pics and videos, this site could undeniably be one of the best in its field. Fantastic blog!

14 May, 2013 06:29 PM

What's up everyone, it's my first visit at this web page, and piece of writing is truly fruitful designed for me, keep up posting such articles.

14 May, 2013 06:29 PM

A motivating discussion is worth comment. I do believe that you should write more on this subject, it may not be a taboo subject but typically folks don't discuss these topics. To the next! All the best!!

Your Comments

Used for your gravatar. Not required. Will not be public.
Posting code? Indent it by four spaces to make it look nice. Learn more about Markdown.

Preview