web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Request for the permission of type System.Data.SqlClient.SqlClientPermission while debugging

(0) ShareShare
ReportReport
Posted on by 65

Hi every one,

I have surfed Internet for a long time but I could not find any answer yet !

I wrote a simple plugin to connect to sql server database, It works when I register it (isolation mode is non), but when I debug it in Visual Studio I get below error !

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Detail: <OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance">
  <ErrorCode>-2147220970</ErrorCode>
  <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <a:key>CallStack</a:key>
      <a:value i:type="b:string" xmlns:b="www.w3.org/.../XMLSchema">   at MyFirstPlugin.MyFirstPlugin.Execute(IServiceProvider serviceProvider)
   at PluginProfiler.Library.PluginAppDomainProxy.ExecuteCore(Stopwatch watch, ProfilerExecutionReport report, Object instance, Object executionParameter)
   at PluginProfiler.Library.AppDomainProxy.Execute(ProfilerExecutionConfiguration configuration, ProfilerExecutionReport report)</a:value>
    </KeyValuePairOfstringanyType>
  </ErrorDetails>
  <Message>Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</Message>
  <Timestamp>2018-08-28T06:27:09.0999149Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

I don't know how to fix this issue.

Could you please help me to find  resolution ?

Best regards

*This post is locked for comments

I have the same question (0)
  • Prashant_ Profile Picture
    1,040 on at

    I have found  similar thread.I hope this will help you.

    community.dynamics.com/.../171481&nbsp;

  • Hamid Reza Profile Picture
    65 on at

    I did like that thread but still same error !

    My Connection is Below :

               SqlConnection Con = new SqlConnection(@"Data Source=iCRM-Develop; Initial Catalog=iCRM_MSCRM; User ID=MyDomain\MyADUsername; Password=MyPasswordString; Integrated Security = true; Connection Timeout=3000");

               Con.Open();

               string myQuery = string.Format("update new_testentity set new_description = 'sqlconnection' where new_testentityid = '{0}'", _current["new_testentityid"]);

               SqlCommand cmd = new SqlCommand(myQuery, Con);

               cmd.ExecuteNonQuery();

               Con.Close();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans