Small Sharepoint Steps – 2
So I’ve set out to write a bit of code that will periodically pull data from a WCF service and insert it in to SP. The code will be executed by the SP Timer Service to gain the scheduling ability of that service. I didn’t want to add the generated WCF config to the web.config as it doesn’t feel like the right place to add it and a custom config location is probably the way we’ll go.
So I wrote the code (extending SPJobDefinition), added a reference to the WCF service, built my endpoint by hand, deployed the code into SP, attached to the SP Timer Service in the VS debugger and waited.
The SP Timer Service kicked off my code and I encountered an exception. I stopped the debugger, made my changes, rebuilt the code, reset IIS (cos SP is essentially a web app), attached to the SP Timer Service with the VS debugger and waited.
Once again, the code threw an exception (the same one). So I stopped the debugger, rebuilt the code, reset IIS, attached to the SP Timer Service with the VS debugger and waited.
Once again, the code threw an exception (the same one). I wont bore you wiht how many times I went round this cycle
but at some point I thought "Huh?", scratched my head, got up and got a cup of coffee. While getting the coffee it dawned on me that while SP maybe a web app, the SP Timer service is a regular Windows service and as such, it loads assemblies into memory at 1st execution time and does not update them unless you restart that service.

net stop "Windows SharePoint Services Timer"
net start "Windows SharePoint Services Timer"
does the trick.
BTW, the fixed code worked a treat.
Leave a Reply