Saturday, October 25, 2014

Microsoft OWIN: Getting base path for web services (C#)

In my recent post on using OWIN and WebApi, I described how to separate your controllers into a separate DLL. Often the controllers need to call other methods that may need access to the base path of the web service (e.g. the bin folder).

The code below can be used to find that base path from other classes, without having to always pass a path parameter from method to method.

Thursday, October 23, 2014

OWIN hosting using a Separate WebApi Controller DLL

Here is a bare bones demonstration (4 minutes) showing you how to create a standalone class library of a WebApi controller, then hosting the controller in Microsoft's OWIN (in IIS). This is done using Visual Studio 2013 Update 3.

The video can be watched here: YouTube Watch

The source can be downloaded here: Download Source

What do you think?

Sunday, October 12, 2014

WeightedRandom - Select content based on weights (C# / .NET)

Need to select content from a collection based on weights?  Here is a great .NET 4+ class that is very helpful.

The class can be used with just about any collection and you can pass in a delegate/lamda to determine what the weight is on each collection object.

Can't RDP? How to enable / disable virtual machine firewall for Azure VM

Oh no!  I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore.  I did ...