Winsmarts.com

Microsoft MVP

MVP Logo

Awarded the Microsoft MVP Award.

Hosted By

blah!bLaH!BLOG!!

Deploying WCF EndPoints as solutions in SharePoint 2007

Posted on 9/8/2008 @ 9:10 PM in #Sharepoint | 0 comments | 4369 views


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

   1:  
   2: @SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"
   3: @SET WSPPBUILDER="c:\code\WspBuilder\WspBuilder.exe"
   4:  
   5: @echo off
   6: Echo Creating Solution Package
   7: %WSPPBUILDER% -outputpath solution
   8:  
   9: Echo Retracting Solution
  10: stsadm -o retractsolution -name HelloWorldSVC.wsp -immediate
  11: stsadm -o execadmsvcjobs
  12:  
  13: Echo Deleting Solution
  14: stsadm -o deletesolution -name HelloWorldSVC.wsp
  15:  
  16: Echo Adding Solution
  17: stsadm -o addsolution -filename Solution\HelloWorldSVC.wsp
  18:  
  19: Echo Deploying solution
  20: stsadm -o deploysolution -name HelloWorldSVC.wsp -immediate -allowGacDeployment
  21: stsadm -o execadmsvcjobs
  22:  
  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.

NEAT!

Please post your comments:


Your feedback will be submitted for moderation, and will appear after it is approved.

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Site designed and maintained by Sahil Malik | All Rights Reserved. ©2007 WinSmarts.com.