File not found

“File not found”-error when trying to activate custom feature on SharePoint

This post was most recently updated on October 9th, 2018.

Reading Time: 2 minutes.

This post is about fixing on of the most non-spesific errors you can get when activating features on SharePoint “File not found”.


“File not found” is one of the more annoying errors one can stumble upon when trying to activate a feature.

File not found
File not found

There are quite a few reasons that can cause this error, but after the obvious ones (some files failing to be included in the package, botched wsp deployment, errorenous urls in event receiver) one thing to check might be the alternate access mappings.

Solution to the “File not found” exception

In our case, we had an event receiver with a code similar to this:

SPList list = ... // logic for finding out a certain list, omitted for clarity

(using SPSite site = new SPSite (list.ParentWeb)) {



This code worked fine in multiple development environments, but when deployed to acceptance testing environment, feature activation failed because of “File not found”-error, both when accessing the site collection features using web browser and PowerShell. Due to certain authentication settings, we were accessing the site using a localhost:123 -typed address, but the list.ParenWeb returned an address with the actual, configured host header – therefore the code above always failed when trying to access the code inside the using -block.

Reason for also the PowerShell failing is not clear, as we were using the actual address (instead of localhost) and still had the same error, but at least we were able to activate the feature using the browser GUI.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments