The other day I was coding on my SharePoint 2010 project and after completion I have deployed to test the same. Guess what I stuck with this error
Now what, debug, troubleshoot, etc. Tried everything but no luck.
I was using Server Side Model for my code, where I just have to access the site, use web object and enumerate records from specific list. So what was wrong? How do I come to know that there was an issue or which part of code was cause an problem. When I started debugging it didn’t showed any error or exception!!! All I got is this error page.
Now the point is how would you come to know what is the issue. Finally it strikes me that lets give it try for our favorite “Event Viewer”. We have to focus on Application logs which are reported against SharePoint Server/Foundation. Following is the default window that comes when we type “eventvwr” in Run prompt.
Which is also showing that there are few new events had occur at top center bar of events list. It means that this is the event viewer details page before we land up with the Runtime Error page. Once we browse that page we will see that we have few new events recorded in windows logs. And that’s it! It will show you the error that has cause this error.
The problem can come from any where, in my case the error was showing that I was trying to use an SPWeb object that has been closed or disposed and is no longer valid. The point here is that we should not only focus on traditional method of troubleshooting, but rather something logical as well.