Tag Archive for: SignalR

SharePoint 2013: Term Store Management Tool and TargetFramework 4.5 plus SignalR

17 Jun 2013
June 17, 2013

In certain situation you want to allow that your SharePoint can utilize the new .NET 4.5 functions – this includes WebSockets for instance. In order to get his running, you have to change the web.config of the corresponding Web Application.

Disclaimer: Use this on your own risk and try it in a TEST or DEV environment first – the change can take down your SharePoint Farm or break core functions!

Manual approach

This is a step by step manual how to set the values that your SharePoint targets .NET 4.5 framework.

  1. Open the web.config with a text editor of your choice.
  2. Navigate to the element with the path /configuration/system.web/httpRuntime
  3. Add the attribute: TargetFramework=”4.5” to the httpRuntime element
  4. Save and don’t close the web.config yet.

After saving, your app pool reloads – everything should be fine by now.

Then try to open the Term Store Management on a site – AND BAM! Broken. At least the Term Store Management is a place I found that this change breaks – there could be others.

Did I mention that this manual approach is totally unsupported? An automated approach with the SPWebConfigModification class would be much better. But this is an example for the readers who made it this far (please leave a comment with your solution, thanks!)

A fix for the Term Store Management Tool

In order to get the not so unimportant Term Store Management Tool up and running, open the web.config again:

  1. Locate the element with the path: /configuration/appSettings
  2. Add this tag: UnobtrusiveValidationMode” value=”None” />
  3. Save and close the web.config

What happens is that the .NET 4.5 Framework introduces some handy ways to tell ASP that it should use unobtrusive validation – in other words html5 validation on input fields – and not validation with a postback/javascript.

How did I notice this?

Actually this was a coincidence. I tried to enable WebSockets for SharePoint 2013 and IIS 8 – and read that I had to change the TargetFramework to 4.5. Luckily I had the Term Store Management Tool open and coincidently refreshed the page – so the error had something to do with my previous change. In addition there is a quite useful error in the event log, so I found the fix rather easily.

Why bother?

So why do I write this? I think I will face this issue again in the future and someone has to write it down, right? And most importantly WebSockets in combination are pretty cool with SignalR – but that’s another story (or blog post for that matter!).

WebSockets, SharePoint 2013 and Signalr - happy coexistence!

WebSockets, SharePoint 2013 and Signalr – happy coexistence!

Issues with this?

Feedback or problems occurred after this change? Scroll down until you see the neat, little comment box!


Update 1: 6/19/2013: Apparently Target Framework 4.5 breaks Office Web Apps – currently I have no fix for this.

SignalR in SharePoint 2013 – the real-time web is coming!

14 Dec 2012
December 14, 2012

If you never heard of SignalR – it’s a real-time web framework for bi-directional communication between a client and server – in short: your server (here SharePoint) can notify a client that something very important happened. Let’s say you want to have Task List and a Dashboard where you can see how many tasks are open (you can watch this example here by Matt Menezes)– in real-time, without hitting F5 permanently and without having an AJAX function polling the list every second. With SignalR that’s possible and the good thing its very easy, some say its magic! I did a small example for visualizing downloads from my SharePoint farm and IMHO it looks very cool. Things change rapidly, as I wrote this I used Microsoft.AspNet.SignalR 1.0 Alpha 2.


Update 02/05/2013: SignalR has changed a lot  – I will write a blog post because the current approach is to complicated for the current SignalR version. Use at your own risk!

Update 06/05/2013: Open Source Solution available  – I released a Codeplex project for SharePoint+SignalR. Please go to http://spsignalr.codeplex.com 


SharePoint 2010 makes it tough!

You all know that SharePoint 2010 runs on .NET Framework 3.5 – yepp, its not getting better. Thing is, SignalR needs .NET Framework 4.0 or 4.5. So the easiest solution was to create a second Application Pool, select .NET Framework 4.0/4.5 and host the SignalR application there. I used a WCF Service in that application, SharePoint event receivers can call the WCF Service and voila you are in the 4.0/4.5 domain (if you are lucky without cross domain issues…).

SharePoint 2013 doesn’t make it easier!

Then SharePoint 2013 came out – finally with .NET 4.0 runtime. I said cool, this should make it easy to host SignalR in the same domain and even in the same Application Pool as SharePoint 2013. Yepp, that’s the theory and SharePoint can sometimes make it a little bit harder than it should be (still, SharePoint 2013 is a rock star!!!).

SignalR Hub in SharePoint 2013

When you create a SignalR application you need a hub. A hub is a class with methods you can call from the clients or externally to notify other clients. In order to communicate all clients need to register on that hub. In normal asp.net world SignalR attaches to the App_Start event where it registers a route “~/signalr/hubs” so clients know the endpoint where they can talk to SignalR hubs or get the hub description file (proxy). With this behavior you have a problem:

There is no App_Start

(You could modify the global.asax – but I want a deployable solution…)

App_Start the SharePoint way

The only deployable way I could imagine to call a function once the app pool spins up  – with several farm nodes – is a http handler. Wait a http handler is call very often, we need to remember this one:

Now we need to add this module to the web.config farm wide – easiest way is the SPWebConfigModification  and a Web Application feature.

Note: The uninstalling method is not shown here, don’t forget it because the SPWebConfigModification remembers the changes!

With that the route will register – only once – and we should be all set right?

SharePoint 2013 yellow page of death

Nasty stack trace

Stack trace:    at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.IsExcludedPath(String virtualPath)

at Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.DirectoryExists(String virtualPath)

at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)

at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)

at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

That doesn’t sound good.

SharePoint and the ~

SharePoint doesn’t like the tilde character. If you add a route (if you don’t, SignalR does) starting with ~, SharePoint shows the yellow page of death. The “easy” fix is to create a custom VirtualPathProvider  – I didn’t know what this class is doing before, too – and just pretend the ~ is not there:

Now register this little sweety in the previously created http module – two problems solved there now:

Okay – that’s it. Open the hub link and finally you get the hub proxy file!

SignalR hub proxy

Does not look too spectacular but a post will follow with some demos – now that I know how it works!

SignalR in SharePoint 2013 –  is there an easier way?!

Tell me in the comments and thanks for reading!

SignalR and SharePoint: Live Download Tracking

13 May 2012
May 13, 2012

I uploaded my first video to youtube today:

Apparently the captions were lost during the upload, next time I will explain a bit more 🙂

Maybe next weekend I add some code examples and further details.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.