Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Kentico with WCF View modes: 
User avatar
Member
Member
joeh42 - 4/27/2012 4:57:40 PM
   
Kentico with WCF
I added a WCF service to my Kentico project, and exposed some JSON through it. However, I noticed that calls to CMSContext seem to return empty strings. In particular, WCF doesn't seem to know which site is being called, even though the user is using one particular site. CMSContext.CurrentSiteName returns an empty string, and I believe Site ID returned 0 or -1.

Also, macros in emails weren't able to resolve out the domain name, and I believe other site specific settings as well.

Is there a way to set the context for a WCF service?

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 4/30/2012 2:59:11 AM
   
RE:Kentico with WCF
Hi,

Of course, that Kentico context information is not available in your web service methods. I guess that you can initialize the context the same way as if you would be working with Kentico CMS API outside of Kentico as per documentation, but it really depends on what exactly you need to get from the context. I would recommend you to call the web service with all parameters which you might need to use (siteid, sitename etc.) and then use them in the web service method according your needs.

Thanks,
Miro

User avatar
Member
Member
joeh42 - 4/30/2012 12:01:54 PM
   
RE:Kentico with WCF
Okay thanks!