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

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

Thanks.

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

 
discard

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.