public override void FeatureActivated(SPFeatureReceiverProperties properties) { // install the service CalcService service = SPFarm.Local.Services.GetValue <CalcService>(); if (service == null) { service = new CalcService(SPFarm.Local); service.Update(); } // install the service proxy CalcServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue <CalcServiceProxy>(); if (serviceProxy == null) { serviceProxy = new CalcServiceProxy(SPFarm.Local); serviceProxy.Update(true); } // with service added to the farm, install instance CalcServiceInstance serviceInstance = new CalcServiceInstance(SPServer.Local, service); serviceInstance.Update(true); }