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

  • Hamid Reza Profile Picture
    Hamid Reza 65 on at
    RE: Request for the permission of type System.Data.SqlClient.SqlClientPermission while debugging

    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();

  • Prashant_ Profile Picture
    Prashant_ 1,040 on at
    RE: Request for the permission of type System.Data.SqlClient.SqlClientPermission while debugging

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

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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans