Deploy asp.net websites with an SSL certificate using Octopus Deploy

Octopus Deploy 3.11 upwards has a nice new feature to manage SSL certificates that makes it simple to deploy a web app with its x509 SSL certificate in a secure manner. Once it’s setup the developer and deployer don’t even need access to the certificate or admin rights of the web server – all of it is managed and secured by the Octopus server itself. Load the certificate into Octopus Whether they are internal of public someone needs to load the PFX certificate file into the Octopus Certificate Library....

April 7, 2017 · 2 min · 367 words · Alastair Crabtree

Cannot open VS 2015 Web project in VS 2017

Brand new installs of Visual Studio 2017 do not seem to be able to open some older web projects created in Visual Studio 2015 or before. To fix you need to add one line to your csproj file. The problem When you open the solution in VS 2017 the project will not be loaded. If you try and right click and reload the project check the output window to see the following error:...

April 5, 2017 · 2 min · 295 words · Alastair Crabtree

Implementing the retry pattern in c sharp using Polly

This post is the third and final installment on the retry pattern following on from implementing a simple retry pattern in c# and the retry pattern for async tasks. In the last two posts we created a retry helper class to allow us to add retry logic to applications without cluttering important application logic with retry code. Now we will solve the same problem using a popular OSS library. Polly is an open source framework for that “allows developers to express transient exception and fault handling policies such as Retry, Retry Forever, Wait and Retry, or Circuit Breaker in a fluent manner”....

December 29, 2016 · 3 min · 611 words · Alastair Crabtree

Implementing the retry pattern for async tasks in c#

This post is a follow on from Implementing a simple retry pattern in c#. Tasks, async and await are rapidly becoming be default API flavours in many dotnet libraries and the performance benefits for IO bound code have been well documented. However if you need to apply the retry pattern to some async or task returning method invocation you need to watch out for subtle errors. I’ll outline the problem and revise my solution from the previous post....

December 2, 2016 · 3 min · 470 words · Alastair Crabtree

Implementing a simple retry pattern in c#

Everything is unstable. You cannot assume that every external service call will succeed on first attempt - the load balancer might be removing a failing host, the database might be being patched, the Ops person might have tripped on the network cable and quickly plugged it back in hoping the boss didn’t notice. If you make an outbound call you probably need an easy way to retry a couple of times before giving up and raising an exception....

December 1, 2016 · 3 min · 629 words · Alastair Crabtree

Converting an SVN repository to Git on windows

Git is everywhere these days, and I can’t really remember how I used to cope without the power of local distributed source control and quick branching. But once in a while I find an old SVN repository I need to convert to git and then push to a git server like github. Here are the easy steps to switch a repositiry from SVN to git and keep the full history. Much is based on the excellent Pro Git book http://git-scm....

November 17, 2016 · 4 min · 779 words · Alastair Crabtree

Cache the result of an async method using LazyCache

The latests release of LazyCache, my open source cache library based on ObjectCache, makes it easy to cache the results of asynchronous or Task returning methods, so now it is simpler for you to speed up your application. Why bother with Async? Async code tends to be more efficient as you release threads while they are waiting for the response from an asynchronous resource, but at a cost of added code complexity....

September 30, 2016 · 3 min · 626 words · Alastair Crabtree

I have to rebase and squash before the pull request will be accepted?!

TL/DR If you want your pull requests to be taken seriously you probably need to learn some more advanced git features like interactive rebase and squash. First I wanted to share an article I found when helping folks that struggle with code review/pull request comments like “Can you rebase that” or “I don’t want to see all your workings – please squash your commits”. If that applies to you, I suggest you have a read of Git Interactive Rebase, Squash, Amend and Other Ways of Rewriting History....

September 8, 2016 · 2 min · 380 words · Alastair Crabtree

How to run a dotnet windows service as a console app

C# Windows services can be a pain to develop because they are awkward to test, debug and run locally. However a few tweaks to the default VS template make them far more manageable. Why use a windows service in the first place? At first glance a Windows Service looks like old tech in an age of http everywhere. However they are a reliable proven platform that is easy to deploy, easy to remotely monitor, and it is actually trivial to embed a web-server inside one and ditch IIS entirely....

August 29, 2016 · 3 min · 618 words · Alastair Crabtree

Detecting plurals in dot.net / C# the way a human might

I recently had a requirement to be able to spot pluralised words which may not be real words, but follow English language conventions, and so appear as a plural to any normal reader. So ComplexBusinesObjects is a valid plural of ComplexBusinesObject but series is its own plural. The idea was to write code that would recognise a plural in the same way a human might, even if it was not perfect grammar....

August 16, 2016 · 2 min · 361 words · Alastair Crabtree