I have CRM 2011 IFD and Make Custom Workflow for Opportunity Entity which run the report using RerportExeution Service and Attach the report as PDF and Send Email to User.
The Error is Coming during Workflow run is
Plugin Trace:
[BLFWorkflow: BLFWorkflow.SendBikeQuote]
[BLFWorkflow (1.0.0.0): BLFWorkflow.SendBikeQuote]
Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: Unexpected exception from plug-in (Execute): BLFWorkflow.SendBikeQuote: System.Exception:
System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpWebRequest.CheckConnectPermission(Uri uri, Boolean needExecutionContext)
at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at BLFWorkflow.SSRS.ReportExecutionService.LoadReport(String Report, String HistoryID)
at BLFWorkflow.SendBikeQuote.Execute(CodeActivityContext executionContext)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.WebPermission
The Zone of the assembly that failed was:
MyComputer
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
Muhammad Sohail