SharePoint does not give error in a user-friendly manner or in a confusing manner. For instance below figure shows it has shown ‘File not found; but the root cause is something different. Developers would like to get the exact function / method name in which the error has occurred.
There are four steps, in other words there are three changes we need to make to the config file and do IIS reset. So let’s go through the four steps to get the actual cause of the above error.
As said previously we need to change the ‘web.config’ file in three different places. You can get the ‘web.config’ file from ‘C:\Inetpub\wwwroot\wss\VirtualDirectories\80’ folder.
Step 1 :-Change callstack value from false to true in SafeMode attribute as shown below.
<SafeMode MaxControls="200" CallStack="false" ...>
<SafeMode MaxControls="200" CallStack="true" ...>
Step2:- Change ‘customErrors’ tag mode from ‘On’ to ‘Off’.
<customErrors mode="On" />
<customErrors mode="Off" />
Step3 :- Change ‘Debug’ from ‘false’ to ‘true’ in ‘Compilation’ attribute.
<compilation batch="false" debug="false">
<compilation batch="true" debug="true">
Step 4 :- Restart the IIS.
You can now see a detail stack error which shows which method exactly has the issue. For instance in this scenario the ‘FeatureDeactivation’ event has the error.
The error in ‘FeatureDeactivation’ event happened because of the wrong URL specified for the ‘SPSite’. If you see the previous error it showed as ‘File not found’ , but in actual it was due to wrong URL name.
Asked In: Many Interviews |