Table of contents
- Basics -
1. Create a WCF Home. This is the virtual directory that will host all your WCF endpoints.
2. Create a WCF Service Library, and throw it in the GAC.
3. Create a relevant .svc file in the WCF home you created in step #1.
4. Write a WCF Virtual Path Provider, and register it in the SharePoint site.
- Real world -
1. Adding WCF Support to a website.
2. Deploying WCF EndPoints as solutions.
All new functionality must be added to your SharePoint 2007 farm using solutions. WCF EndPoints are no different.
Here is how you can add WCF endpoints neatly packaged as solutions to your SharePoint farm.
1. Enable WCF support on your website.
2. Start with the WCF service library you were working in Step #2.
Add the following folder structure as shown below:
3. Put the following code in your install.bat
2: @SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"
3: @SET WSPPBUILDER="c:\code\WspBuilder\WspBuilder.exe"
5: @echo off
6: Echo Creating Solution Package
7: %WSPPBUILDER% -outputpath solution
9: Echo Retracting Solution
10: stsadm -o retractsolution -name HelloWorldSVC.wsp -immediate
11: stsadm -o execadmsvcjobs
13: Echo Deleting Solution
14: stsadm -o deletesolution -name HelloWorldSVC.wsp
16: Echo Adding Solution
17: stsadm -o addsolution -filename Solution\HelloWorldSVC.wsp
19: Echo Deploying solution
20: stsadm -o deploysolution -name HelloWorldSVC.wsp -immediate -allowGacDeployment
21: stsadm -o execadmsvcjobs
23: Echo recycling AppPool
24: %windir%\system32\inetsrv\appcmd recycle AppPool "SharePoint - 4000"
4. Put a call in post build events to call Install.bat .. usually looks like this - cd $(ProjectDir) .. Install.bat
5. CTRL_SHIFT_B to build and deploy, you should see the endpoint deployed as a solution, which you can verify by going to central admin --> operations --> solution management.
This is shown as below:
That's basically it! Now you can retract/deploy it from all web front ends, and use it easily inside other applications or within SharePoint.