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

I developed a SharePoint 2010 WSP that contains a custom HTTP Module for performing short-url redirects. The WSP also contains a WebApplication scoped feature that consists of a feature receiver that updates the web.config with a reference to the HTTP Module.

My problem is that when I install the WSP using powershell, it automatically enables the feature for all of the web applications on the server, with the exception of the Central Administration web application. I would like to be able to specify which web applications the feature is enabled for in my powershell deployment scripts.

Here is my script:

add-spsolution -LiteralPath "C:\temp\MyRedirectModule.wsp"
install-spsolution -Identity "MyRedirectModule.wsp" -GACDeployment

I have tried doing this:

install-spsolution -Identity "MyRedirectModule.wsp" -WebApplication http://mysite -GACDeployment

but this results in the following error message: This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

Thanks for your help!

share|improve this question
Mark, I have a solution very similar to yours - deploys an HTTP Handler, in my case - and I wanted to limit the functionality to a single web app, which I accomplished by setting ActivateOnDefault to false, as did you. However, I am experiencing an issue that when I activate the feature on one web app, both my web apps' web.config files have their modified by date updated to the current date, but only the one that the feature was activated on had the changes applied. (Central Admin not affected). Do you recall if you experienced the issue? – Chloraphil Feb 27 '13 at 3:55
did any one got the solution for this.I am also facing the same issue that I have a http module for a specific webapplication. when I am deploying the feature with scope as webapp for adding the entry in web.config it is deploying to entire farm and adding the entry to all webapp config files and needs feature activation (as expected). – user25078 Apr 11 '14 at 14:20
up vote 1 down vote accepted

Verify that Scope="WebApplication" on your feature definition. I'm also not sure it's looking for a URL after the -WebApplication switch...try the name or the GUID.

Alternatively, you could set ActivateOnDefault to FALSE in the feature definition and use Enable-SPFeature on the specific web application after the add-spsolution and install-spsolution commands.

share|improve this answer
I needed to set ActivateOnDefault to false on my feature definition to prevent the features from being automatically enabled. Thanks for the help! – Mark Bell Jul 26 '11 at 19:33

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.