c# - NullReferenceException when calling Sitecore Database.Templates[] inside WCF service -


i'm new sitecore development, apologies if question basic. i've created both agent (scheduled task) , wcf service , have them both added sitecore project. agent calls same code wcf service code calls.

the issue having when call database.template[id template] passing in id container of corresponding template item want process, works inside agent task, not inside wcf service.

any call database.template[id id] inside wcf service giving me nullreferenceexception, exact same call inside agent gathers template properly.

is due structural reason dependent on calling application being webpage instead of webservice?

edit #1: have svc allowed extension, , have tried both

sitecore.configuration.factory.getdatabase("master")  

and

var sitecontext = sitecore.configuration.factory.getsite("websitemaster"); sitecontext.database.template[];  

both return nullreferenceexception.

i can obtain item, using getitem, when try access template property of item, nullreferenceexception.

you have no sitecore context wcf service , sitecore.context.database null.

you can either add svc list of allowed extensions or data via sitecore.configuration.factory.getdatabase("master")


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -