RedisSessionStateProvider – unknown command ‘EVAL’

A couple of days ago I was trying to use Redis as session storage for one of my ASP .NET websites. Even though it seemed to be a rather straightforward task (Scott Hanselman wrote about that a while ago), I ended up with some weird exception while running the app: ERR unknown command ‘EVAL’
unknown command 'EVAL'
This wasn’t for sure a connectivity issue, as I was able to connect to Redis server from Redis Clientredis-cli. For me it looked like my server is not able to “understand” EVAL command. I started digging around and it turned out that this command has been introduced in version 2.6.0
I’ve connected to the server using redis-cli and checked the version with

command and basically that revealed the problem.
rediscli
As you can see I’ve accidentally installed version 2.4.6 (I have no idea how I ended up with so old version). After upgrading to the newest one, my problem was gone and I was able to successfully store session in Redis.
working

RedisSessionStateProvider – unknown command ‘EVAL’

Visual Studio – restoring default exception window

I think everyone is familiar with this nice exception window we see once exception is thrown.
exceptionwindow
However today for some reasons my VisualStudio started showing some weird dialog.
exceptionwindow
This was pretty frustrating as I wasn’t able to see which line has thrown exception and basically after clicking “Break” or “Continue” application was terminated. After a while I found out that the default window is called “Exception assistant” and you can enable it in Visual Studio’s options. So in order to restore default behavior, just go to Tools -> Options -> Debugging -> General and select “Enable the exception assistant” checkbox.
enableexceptionassistant

Visual Studio – restoring default exception window

Fiddler – request redirection

As a back-end developer I am quite often contacted by front-end devs to take a look why certain UI calls to the server results in wrong data being returned by API. Usually I am provided with request payload so it is quite straightforward to reply it with Postman or Fiddler and see what is going on the backend. However for time to time, replying single request is not enough to reproduce the problem. In that case it is easier to just recreate the scenario on the UI and debug the API during that process. Unfortunately this approach requires backend devs to have UI up and running on their local machines and that is not always possible (e.g. you might not get access to UI repository). Fortunately with Fiddler it is quite easy to intercept outgoing front-end calls to the API and redirect them to your locally deployed version (so you can easily debug the API).
Let’s assume we would like to redirect all simpletestspa.azurewebsites.net calls to localhost:50277. In order to do that run Fiddler and go to Tools -> Hosts…
Fiddler - tools
Select “Enable remapping of requests for one host to a different host or IP, overriding DNS” checkbox
Fiddler - hosts window
and enter following values in the editor

From now every outgoing request to simpletestspa.azurewebsites.net will be redirected to your local instance of the server on localhost:50277.

Fiddler – request redirection

Cake – Data at the root level is invalid

Couple of weeks ago I mentioned that in my current project we use Cake as a build mechanism. Recently we wanted to add simple functionality to our build script, which would allow us to modify one of the App.config‘s properties. According to the documentation it should be a straightforward tasks, as all the heavy lifting can be done via XmlPeek and XmlPoke aliases.
Our initial script looked as follows

And what was surprising for us, it didn’t work.
dataattherootlevel
We got a bit weird error “Data at the root level is invalid. Line 1, position 1”. The exception suggested that there was something wrong with our App.config file. However if you look at the picture presented above, you will see that we were able to successfully read the file and retrieve value of Version with XmlPeek method. After a bit of digging it turned out that XmlPoke and XmlPokeString are not able to work with relative paths and we have to use absolute one in order to make it work. Fortunately there is an easy way to do that, namely MakeAbsolute method. Out script after modifications looks that way

And now everything works fine
after

Source code for this post can be found here

Cake – Data at the root level is invalid

Intercepting browser requests with Postman

If you are doing any kind of rest api development you probably have heard of Postman. Long story short, it is a Chrome extension which allows you to send http requests in a very easy and intuitive way. Apart from that (and many other features), it also allows you to intercept browser request. As this feature is very easy to overlook, here is a simple guide how to use it.
In the Postman window, click little satellite look-like button and toggle the “Interceptor” switch
Postman switch interceptor
Postman will ask you to install additional plugin called Postman Interceptor
Install
Once you click “Install” you will be redirected to Chrome Web Store where you can add the plugin to the browser. After successful installation you will see additional icon in Chrome menu bar. Click it and toggle “Request capture” switch
CaptureEnabled
When you go back to Postman and toggle again “Interceptor” button, it will be synchronized with Postman Interceptor plugin
InSync
and from now on, requests sent by browser will be visible in requests history
Interception
where you will be able to modify and resend them.

Intercepting browser requests with Postman