I am new to .net and sharepoint world and using sharepoint 2013. My custom webpart is accessing a webservice, which is in the different solution. When I run the webpart in the debug mode in Visual Studio, the custom webpart is working fine and assessing the webservice, but when I deploy it using the following instruction. SharePoint Online(2013) - Web Part Deployment I am getting the following exceptions:

  1. 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. Correlation ID: f8b2499d-e666-f05b-589b-c4d87c65a480.

  2. [SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]

any idea if I need to change some settings in the web.config or any other place?

1 Answer 1


Based on the error message, its very clear that you are using a sand-boxed solution so please modify or create a farm based solution which will resolve these issues.

The main reason for the errors is that sand-boxed solution's has certain boundaries with respect to permissions and scope in the which the code can run. for example it doesn't have elevated privileges and so on. Also, its a limitation that in SharePoint online you can't deploy farm based solutions.

Alternate suggestions would be to develop a remote hosted app so it can have full control and access the web services with out any problems. only down side is you need to host that app either in azure or your own hosted iis/web server.


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.