Calculator Service Source Code

By request, see the attached file for an early look at the source code for the Calculator Service as a Visual Studio 2010 project.

This is a work in progress. Some features are not yet implemented, and I haven’t yet explained some of the implemented features. Use at your own risk, no warranties implied, etc.

Note that I’ve found that an iisreset is usually required after retracting and before re-deploying the solution.


Comments (9)

  1. Amit K. Saxena says:


  2. Przemek says:


    How to deploy this service to SharePoint server? I used "Deploy" option from project context menu in VS 2010, but it deosn't work

  3. dtaylorus says:

    Hi Przemek,

    Make sure you've set the Site URL property for the project (I use the URL of the SharePoint Central Administration site). Also, I found that an iisreset is a good idea before deploying the project. If deployment is successful, you should see the "Calculator Service" feature in the "Manage Farm Features" page in the central admin site.


  4. Przemek says:

    Hi David.

    Thanks for answer. In my case I have a problem with _LAYOUTS/Sample/Calculator/CalculatorTest.aspx page. I got Microsoft.SharePoint.SPEndpointAddressNotFoundException (There are no addresses available for this application) from line 24. Service has been successfully deployed and started (Calculator Service Application and   Calculator Service Application Proxy). Required files have been uploaded to ADMIN, Layouts, POWERSHELL, WebClients and WebServices directories. The problem is that in IIS Manager in "SharePoint Web Services" sections there isn't any new virtual directory after starting a service.

    I added this virtual directory manually (as name passed guid of started service application without "-" chars), but it also doesn't help

    I tested your solution on SharePoint 2010 RTM.

  5. Przemek says:

    Hi David

    It works! I forgot to start service in "Central Administration -> System settings -> Services on Server". Sorry for disturbing you:)

    – Przemek

  6. dtaylorus says:

    Hi Przemek,

    Glad to hear it works! Starting the service instance is not an obvious step, so thanks for the feedback.


  7. Dave says:

    Thanks for the code sample!  The package's Deployment Server Type is set to WebFrontEnd.  This seems to create the service on the WFEs in the farm but not the application servers.  When we change the Deployment Server Type to ApplicationServer, the feature doesn't seem to get activated, in fact it doesn't show up in the list of farm features (even though the the solution is listed in Farm Solutions).  Please advise if there is something we may be doing incorrectly or if there are additional steps that need to be done to get the service available on the application servers.

  8. Adam says:

    When deploying the solution I get the following error,

    Error occurred in deployment step Add Solution: CalculatorService.CalculatorServiceInstance cannot be deserialized because it does not have a public default constructor…

    Any ideas?

  9. dtaylorus says:

    Adam, because this object is serialized and stored in the SharePoint configuration database, it must have a public default constructor. Double-check that CalculatorServiceInstance.cs contains the "public CalculatorServiceInstance() { }" constructor.

Skip to main content