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!

  • 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, 2013 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, 2014 at 14:20

2 Answers 2


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.

  • 1
    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, 2011 at 19:33

Any WSP deploying assemblies to GAC must be a farm solution and would be deployed on all Web Applications. Turning the ActivateOnDefault switch off only disables it in the features list of web application. If you need complete isolation of deployment and activation for a single web application, go with the BIN deployment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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