Easier Redis development with scriptcs and ServiceStack.Redis powered C# REPL
In my current project I am working a lot with Redis on the back end. What I have found extremely useful is the ability to work with Redis directly from its REPL (redis-cli), to instantly check or reset the objects stored there.
However, working in the C# environment, the basic redis-cli is definitely not enough to facilitate productive development.
Enter scriptcs.
Asynchronous action filters in ASP.NET Web API
It is rather to common to use filters in Web API to perform common tasks around your actions in an AOP (aspect oriented programming) way.
To create a filter you simply inherit from an abstract ActionFilterAttribute class and override the relevant method:
public abstract class ActionFilterAttribute : FilterAttribute, IActionFilter
{
public virtual void OnActionExecuting(HttpActionContext actionContext)
{}
public virtual void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{}
}
This is all nice and simple, but what if the operation you need to perform, should by asynchronous? Surely async void is a terrible idea.
Output Caching in ASP.NET Web API 2
A while ago I released a little library for Web API caching - called CacheOutput.
With the release of Web API 2, some things change (obviously the Web API core gets a bump to 5.0) so the library required a new release. I have decided to take a page out of the book of my friends over at Autofac, and do not release over the old Nuget package, but instead release a new one specifically for Web API 2.
If you are in need of caching for Web API 2, you should use the package called Strathweb.CacheOutput.WebApi2
ASP.NET Web API 2 is out! Overview of features
Today the ASP.NET team released ASP.NET Web API 2 (and, for that matter, MVC 5 too)! The announcement, just as like year, followed many other big Microsoft releases (Windows 8.1, Visual Studio 2013 etc) in a synchronized product shipping event.
New Web API is now available on Nuget - where it directly replaces the old version of Web API. Let’s look at the major features of ASP.NET Web API 2.
Extend Glimpse on the fly – scriptcs code execution tab in Glimpse
In scriptcs, one of the things we have been paying lots of attention to recently, is the hosting story. Scriptcs CLI is simply just one of the clients using the core scriptcs libraries - which can be used to embed the rich scriptcs code parsing and execution capabilities in any app.
This weekend I put together a small Glimpse plugin which uses scriptcs hosting, and can be used for executing arbitrary code against the context of your ASP.NET application.
More after the jump.
Dynamic per-controller HttpConfiguration in ASP.NET Web API
Recently I faced an interesting problem, where we needed to provide controllers with controller-specific configuration - but based on settings only known at runtime.
In Web API, per-controller configuration is a very useful, yet little known feature (aside from a great blog post by Mike Stall), as it allows you to create configuration profiles and assign them to specific controllers.
However it is only supported statically - through attributes, so it cannot be altered at runtime. Let’s have a look at how you might be able to hack away at it.
Adding high performance Windows Azure Cache Service to your ASP.NET Web API
Microsoft has recently announced the preview release of Windows Azure Cache Service - intended to allow you to easily deploy high performance, dedicated, distributed cache for your applications.
You can read more about the feature (and it does seem really awesome at first glance), in the thorough announcement post by Scott Guthrie.
Let’s look at how you can leverage this powerful service from ASP.NET Web API.
ASP.NET Web API 2 and HttpRequestContext
Last week (23 August) ASP.NET Web API 2 RC (release candidate) was released on Nuget. One of the interesting changes in this version is the emergence of HttpRequestContext - which provides a shortcut, strongly typed access to the information which up to this point hidden inside of Request.Properties dictionary, as well as some additional useful bits and pieces.
Let’s explore what’s under the hood.
Customizing controller discovery in ASP.NET Web API
One of the useful configuration features of ASP.NET Web API is that it allows you to be explicit about the assemblies into which it will look in order to discover controller types.
This is especially useful if you have assemblies residing outside of the bin folder, or if you are doing self hosting, and the controllers assemblies are not automatically loaded into the current AppDomain.
There are several hooks in the pipeline that you can plug into to achieve this goal. Let’s explore them, discussing the pros and cons of using any of these.
Message handlers scoped per route in ASP.NET Web API
A lot of Web API functionalities are based around message handlers. The real power of them is that they run for every request and provide an easy mechanism of globally addressing some of the application concerns (such as i.e. security). However, there are situations where you’d like to use a handler to apply specific behavior to only a selected portion of an application.
Let’s have a look at how you’d do it with route-specific message handlers
About

Hi! I'm Filip W., a software architect from Zürich 🇨🇭. I like Toronto Maple Leafs 🇨🇦, Rancid and quantum computing. Oh, and I love the Lowlands 🏴.
You can find me on Github, on Mastodon and on Bluesky.

Recent Posts
- 2025/03/10, Running Phi models on iOS with Apple MLX Framework
- 2025/02/24, Strathweb Phi Engine - now with Phi-4 support
- 2025/02/14, ML-KLEM and ML-DSA Post-Quantum Cryptography in .NET
- 2025/01/17, Fine tuning Phi models with MLX
- 2024/12/20, Running Phi Inference in .NET Applications with Strathweb Phi Engine
Categories
- ai (20)
- ai search (5)
- apache cordova (1)
- asp.net 5 (17)
- asp.net core (47)
- asp.net mvc (35)
- asp.net mvc 6 (7)
- asp.net vnext (6)
- asp.net web api (96)
- astronomy (1)
- autogen (1)
- azure (22)
- azure service bus (1)
- azure-devops (1)
- benchmark dotnet (1)
- bing maps (1)
- blazor (2)
- c plus (2)
- c-sharp (156)
- cryptography (6)
- csharp (6)
- csharp 10 (2)
- dnx (3)
- dotnet-cli (2)
- dotnet-script (11)
- duende (4)
- editorconfig (1)
- entity framework (2)
- espn api (2)
- events (1)
- ffi (4)
- fsharp (1)
- git (1)
- glimpse (1)
- html5 (4)
- identity server (2)
- iis (2)
- il (1)
- intro to qc (19)
- ios (7)
- javascript (9)
- jquery (4)
- jquery mobile metro (1)
- katana (2)
- kindle (1)
- knockout.js (8)
- kotlin (2)
- last.fm api (2)
- linq (1)
- mac (3)
- macos (1)
- mathematica (1)
- msbuild (3)
- mvc core (3)
- nancy (2)
- native (1)
- net (144)
- net 5 (3)
- net 6 (5)
- net 7 (7)
- net 8 (3)
- net 9 (1)
- net core (49)
- net sdk (2)
- ninject (2)
- odata (4)
- oidc (2)
- omnisharp (13)
- openai (11)
- osx (2)
- owin (5)
- phi (8)
- php (1)
- python (1)
- q-sharp (36)
- qir (3)
- qiskit (1)
- quantum computing (41)
- roslyn (30)
- rust (6)
- scriptcs (11)
- scripting (9)
- security (9)
- servicestack (2)
- signalr (8)
- swift (9)
- testing (5)
- twitter boostrap (1)
- typescript (1)
- visual studio (4)
- visual studio code (11)
- wasi (3)
- wasm (3)
- windows phone 7 (1)
- wordpress (1)
- wpf (2)