Problems serving .svc in IIS 8 on Windows 8

I recently had some problems running telerik Sitefinity on my dev machine.  When I clicked on the Pages menu, it would give me a popup telling me that IIS 8.0 returned a 404.

All the help online talked about reregistering the WCF stuff using Servicemodelreg.exe, but doing that seemed to screw stuff up even more.  Others also talked about using aspnet_regiis, but that doesn’t work in Windows 8.

Finally, I found this post that dealt with the exact issue.  Adding the WCF Services under Turn Windows features on or off worked perfectly.

Thanks to http://proq.blogspot.com/

Advertisements

Accessing Session from an HttpHandler

I found this out today.  If you want to access the Session from an HttpHandler, you need to implement one of two interfaces.  Either: IRequiresSessionState or IReadOnlySessionState.

Those interfaces don’t have any members but by implementing them you are allowed access to the Session.

Background tasks in asp.net

Recently a site I was working on, http://www.walshgroup.com needed to periodically pull down data from an external data source.  I could have put this logic at the start of some request operation but then there would be some user waiting longer for his response than needed.

I ended up using this technique to refresh the dataset at regular intervals without messing with the users experience.  For simple stuff, it beats writing a separate job to do this.

ASP.Net MiniProfiler

This is a pretty cool looking tool from the Stack Exchange people called MiniProfiler.

You just add some profiling info to your code like this:

using (profiler.Step("Doing complex stuff"))
{
    using (profiler.Step("Step A"))
    { // something more interesting here
        Thread.Sleep(100);
    }
    using (profiler.Step("Step B"))
    { // and here
        Thread.Sleep(250);
    }
}

and see the result live in the browser like this:

Mini Profiler rocks your world with stats right in your page