This afternoon Todd Bleeker opened his TechEd session, Creating Custom SharePoint Service Applications 101 by saying that Service Applications is "probably the most complex topic you can talk about in SharePoint 2010." Todd went on to say that this session would represent "One of the few times in the last decade I've done a technical presentation [with] no demo," explaining his rationale as "I could probably build one in an hour, but it would kill you." Thus, Todd chose to focus instead on the fundamentals in his session, explaining that the slide deck, along with source code for a sample service application would soon be posted on his blog.
Todd is famed as being an energetic speaker, and I must say that he was easily the most animated presenter I've seen all week, fairly bursting with passion for his subject matter. I'll be honest, Todd works fast, and I did my best to keep up, but … well, let's just say that interested parties would unquestionably be best served by visiting Todd's blog and downloading the (incredibly detailed) slide deck and the accompanying source code.
Beginning with a brief history of what would ultimately become service applications, including a discussion on conceptual versus actual topology, Todd then moved on to ask the question, "Why use an application layer?" The reasons he provided were that "We want to offload the processing of something that's incredibly intensive, we want to centralize state," and cross platform (farm).
Todd explained that the "Service application framework is created to mitigate ASMX issues," and involves: hosted, middle-tier services; scalable shared services; the ability to be consumed by multiple SharePoint Web applications or even external consumers; "and it's extensible." Also provided by the service application framework are: provisioning; optional management pages; claims awareness; backup, restore, and upgrade support; pluggable round robin load balancer; and custom permissions which are "built into Central Administration."
Following "A little bit of SharePoint history to explain why SharePoint needed one of these," Todd explained that to create a service application, some kind of service to surface must first exist. If such a service doesn't yet exist, you'll need to create some sort of WCF. Todd shared the "anatomy of service application" as consisting of:
- SVC
- Contract (behavioral and maybe a data interface)
- {SharePointRoot}WebServices
- {SharePointRoot}WebClient
- DLL to GAC
Next you need to create the infrastructure for the service application, using core component names as class suffixes for each of the five classes:
- *Service ("All it does is say, 'I have a service.' You get one per farm.")
- *ServiceInstance ("I call this the on/off switch," and it allows you to turn a service on or off on a given server.)
- *ServiceApplication (When you say "New" and it shows up accordingly.)
- *ServiceProxy ("Used to consume it on the client." Here again, there is one per farm.)
- *ServiceApplicationProxy ("The actual mechanism by which the client talks to the service proxy.")
Todd said that there is also a full range of optional extensions "you might want to do," including such things as PostDeploy.ps1 PowerShell Script, and custom SAF permissions. You'll find the full list of optional extensions in Todd's slide deck. As well, exhaustive details pertaining to each of the five classes described above will also be found in the deck.
Todd wrapped up by talking through a slide outlining the individual steps involved in developing your first service application:
- Create WCF Service; host in IIS
- Test service with WcfClientTest.exe
- Write 5 classes of SA (3 server, 2 client)
- Add GUID; default 'ctors, other 'ctors, TypeName
- Farm Feature Receiver creates/destroys:
o Service (1/Farm)
o Service Instance (1 each server)
o Service Proxy (1/Farm)
- Proxy Groups – Web Application Association
- PowerShell to Auto-Create
- _LayoutsProjectsConsumer.aspx (Application page)
Again, don't forget to keep an eye on Todd's blog for his slide deck and the source code for a sample service application. Todd said that those resources would be posted "hopefully in the next couple days."
Read our complete coverage of Microsoft TechEd North America 2011:
- 'Applying Branding from an Existing Website to Microsoft SharePoint 2010' with Jon Flanders
- 'Creating Self-Service Analytic BI Applications with Microsoft SharePoint 2010' with Peter Myers
- 'The 10 Immutable Laws of Microsoft SharePoint Security' with Rick Taylor
- 'Integrating Microsoft SharePoint 2010 and Microsoft Dynamics CRM Online' with Girish Raja
- Daniel Benson & Mark Stone on 'Creating Great End User Experiences with Fast Search for SharePoint 2010'
- 'Claims Identity in Microsoft SharePoint 2010' with Paul Schaeflein
- Chris Mayo on 'Developing Collaboration Solutions in the Cloud with Microsoft SharePoint Online'
- 'Creating Custom SharePoint Service Applications 101' with Todd Bleeker
- Aftab Alam & Chris Hopkins on 'IT-Centric Dashboards in Minutes with Microsoft SharePoint 2010 Using Microsoft Visio/Visio Services'
- 'Plan and Deploy My Site for Microsoft SharePoint Server' with Chris Gideon