SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.