Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

in this code variable _service is null. Any idea what's wrong? It was working before without any problems...

private SPWebApplication _service;
_service = properties.Feature.Parent as SPWebApplication;


share|improve this question

1 Answer 1

up vote 2 down vote accepted

It seems that your feature is not web application scoped.

share|improve this answer
Oh yeah, right, is there possibility to get SPWebApplication without running on WebApplication Scope? – Peter P May 21 '12 at 12:40
This is the also way how to get WebApp on Web scope... var web = properties.Feature.Parent as SPWeb; _service = web.Site.WebApplication; – Peter P May 21 '12 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.