I deployed my WSP to the SP server and activated my solution. When I attempted to add my web parts to a page I get the message:

A Web Part of Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe.

After more research I added the SafeControl attributes to the manifest file. I was able to update it again but now I get this error when I add a web part on the page:

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

Also checked the web.config and I see entries that look correct. My project DLL file is also in the GAC.

Any other ideas?

  • @Unnie Yes a farm solution – Alex Apr 23 '14 at 20:56
  • This error normally occurs with sandbox solution.Have you previously deployed this webpart as sandbox by any chance? – Unnie Apr 23 '14 at 21:08
  • @Unnie No this is the first time I deploy it. I just used Add-SPSolution to install it. – Alex Apr 23 '14 at 21:10
  • r u using CQWP class in your code? – SharePointMan Apr 24 '14 at 6:32

Most of the error message shown in the screen are generic error messages they do not give you much details,

If possible turn on verbose logging on your environment and get the exact error message from the ULS log that will give you more details on the issue.

|improve this answer|||||
  • Also check if you have given the correct reference for your custom web part details (token etc.) I hope you are using fully qualified name for the DLL. Most of the web part errors i have seen when i am calling my custom class and the code is not able to find any reference. – Sudhir Kesharwani Apr 23 '14 at 20:53
  • Thanks for the comment. How can I turn this ULS logging on? I'm not a big SP developer, just getting started. – Alex Apr 23 '14 at 20:55
  • ULS logs are created in 14\Logs directory. Just open the current file in the ULS Log Viewer and perform the operation. ULS logs record all SharePoint activites – Sudhir Kesharwani Apr 23 '14 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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