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)

The crazy error message CRM plugin Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

(0) ShareShare
ReportReport
Posted on by 1,532

Hi,

I am using on-premise.  I have tried everything to fix this error message.  I have changed permission.  I am not using sandbox.  How can I fix this.

I have a file on my local machine that I am using to access.

I am using Microsoft Dynamics CRM 2016(8.1.0.359) (DB 8.1.0.359)

Here's the plugin C# code

protected override void ExecuteCrmPlugin(LocalPluginContext localContext)

{
  if (localContext == null)
  {
     throw new InvalidPluginExecutionException("localContext");
  }

  // TODO: Implement your custom Plug-in business logic.
  // TODO: Implement your custom Plug-in business logic.
  IPluginExecutionContext context = localContext.PluginExecutionContext;
  IOrganizationService service = localContext.OrganizationService;

  //Get the CVS file
  var getCvsFile = @"C:\temp\test1.csv";

  StreamReader reader = new StreamReader(File.OpenRead(getCvsFile));

  int lineCnt = 0;
  while (!reader.EndOfStream)
  {
     if (lineCnt == 0)
       continue;

       var line = reader.ReadLine();
       var values = line.Split(',');


I have create an action that is being executed from javascript

Action process

actionProcess.JPG

Javascript

function CallActionPlugin(execObj, iOption){
$.ajax({
  url: Xrm.Page.context.getClientUrl() + "/api/data/v8.0/new_LoadCalibrationData",
  type: 'POST',
  success: function(responseText){
   //var jsonData = JSON.stringify(responseText); 
    //myArr = JSON.parse(jsonData );   // parsing JSON
                alert(" -- Action Called - 23");
//    updateMap(myArr); 
  }
});

Here's my plugin register

86822.Capture.JPG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Register your assembly without isolation to work with File System. Otherwise you will not be able to.

  • rthompson Profile Picture
    1,532 on at

    Hi Andrew,

    My assembly is set to "none".

    Register.JPG

  • rthompson Profile Picture
    1,532 on at

    Hi Andrew,

    So disable the Isolatable on the plugin.  Is that correct?

    Register2.JPG

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Ideally this is happen when the User does not have write access to the file system under which user context plugin is executing .So try with service account user in the "Run in User's Context "plugin registration tool.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Check if user of w3wp (IIS) application has privileges on c:\temp folder. If it doesn't - give full privileges on it.

  • rthompson Profile Picture
    1,532 on at

    Hi Goutam,

    I have changed the user several times.  Still no luck.  I am not using sandbox.

    I do see that isolatable contains "unknown".  What should that be?

    Register3.JPG

  • rthompson Profile Picture
    1,532 on at

    I have a stupid question.

    I am trying to access my local machine c:\temp.

    I am wronging if the plugin is using the CRM server c:\temp.  If that is turn then that might be my issue.

    I am using remote connection.

    So were is the plugin trying to read from?  Local machine or CRM server (on-primes)

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Plugin tries to access disk of environment where it is executed ie frontend server where IIS is installed.

  • gdas Profile Picture
    50,091 Moderator on at

    Could you please try to do following -

    => Set Run as User Context as Calling User

    => Go to CRM application Server > IIS > Application Pool --> Dynamics CRM > Check the App pool User has access of file write and read in the server.

  • rthompson Profile Picture
    1,532 on at

    Hi Goutam,

    I have tried you suggestion and still having the same issue.   Still have not figure out how to fix this issue.

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