Friday, October 14, 2011

Calling WCF SVC Service from SharePoint Application Page

I was facing this problem after few hours of search got the solution, and sharing with you guys
  • Create New SharePoint 2010 Empty Project / Open any existing SharePoint 2010 Project
  • Right Click on your Project -> Add -> Sharepoint "Layouts" Mapped Folder



  • Right Click Layouts Folder and Add Application Page .aspx 



  • Right Click References and Add Service Reference


  • Input the your service Address ending with .svc 


  • Give Namespace and Click OK
  • app.config will automatically be created in Project, open the app.config  Copy the Values inside tag <system.serviceModel><system.serviceModel> 



  • Now go to Layouts folder it will be at your Sharepoint installation and open web.config "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config"



  • Paste your <system.serviceModel><system.serviceModel> in web.config Save and Close


  • Now your service is ready to use
  • Go to your application.aspx.cs consume service 
  • Deploy your project or F-5 to get WCF service working :)

--
Shahzad Afzal
http://www.pakistanprobe.com/



No comments:

Popular Posts