locked
ms crm 2011 - Importing the managed solution with plugin is importing the solution with warning? RRS feed

  • Question

  • Hi

    ms crm 2011 - Importing the managed solution with plugin to the online instance it is importing the solution with warning?

    I have registered the plugin in isolation mode - "Sandbox".

    can any one help me on this.


    Thanks, Rajeev

    Thursday, November 8, 2012 5:38 AM

Answers

  • Hi,

    it looks like in your code in your plugins you are taking actions that can only be taken in a non-sandboxed plugin. This is causing the security exceptions. In order to be able to register your plugin in the sandbox you will have to come up with some workaround for the code that is causing these issues.

    In order to find out which code causes the security restrictions you can take a look here or here. Examples of such unsupported actions in a sandboxed plugin are access to the file system, calling a service via "localhost" or via an IP address etc. etc.

    Please try to find the code that causes these issues or post your code so that we can identify the problem.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    • Marked as answer by CRM Rajeev Friday, November 9, 2012 8:42 AM
    Friday, November 9, 2012 8:04 AM

All replies

  • Hi

    ms crm 2011 - Importing the managed solution with plugin to the online instance it is importing the solution with warning?

    I have registered the plugin in isolation mode - "Sandbox".

    even, while deploying I have checked the checkbox "Post Import Actions" - Activate any processes and enable any SDK message processing steps included in the solution.

    can any one help me on this.


    Thanks, Rajeev


    Thanks, Rajeev

    Thursday, November 8, 2012 5:42 AM
  • Hi,

    Are You importing the Solution while the Plugins are Activated??

    You can try importing the solution by deactivating all your Plugins to get rid from Warning.


    Naren

    Thursday, November 8, 2012 6:16 AM
  • Hi,

    if you are importing an update for an already existing solution, then you don't need to worry about the warnings. They just mean that the previous SDK message processing steps were diabled, in order to be replaced with the new (updated) ones.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.


    Thursday, November 8, 2012 7:25 AM
  • I am getting following error,

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #DD62F79BDetail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #DD62F79B</Message>
      <Timestamp>2012-11-08T09:54:04.8249291Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>

    [CLASSNAME: CLASSNAME.PreCreateDelete]
    [e444ee30-8918-e211-9e7c-080027f61b75: CLASSNAME.PreCreateDelete: Create of new_entityname]

    </TraceText>
    </OrganizationServiceFault>

    Can anyone tell, why exactly the error is coming once the solution is imported with the plugin which fires on create of the record in custom entity.


    Thanks, Rajeev

    Thursday, November 8, 2012 10:00 AM
  • Hi,

    please check that the user that is executing the plugin has enough privileges to perform the operations in your plugin. Also check if the plugin is running under the current user's context or under the context of a specific user.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Thursday, November 8, 2012 10:10 AM
  • Thanks Pavlos,

    Here it seems the problem is registering the plugin in isolation mode - sandbox. When I am selecting None as Isolation mode then in the source system it is working fine.

    The source system is at IFD(Internet Facing Deployment.). In the source system I am creating the solution and adding the plugin to it.

    But while importing this solution to online instance it is giving error regarding Isolation as follows:

    " PublicKeyToken=b5c1dd849a0f714c': Assembly must be registered in isolation."

    but is it possible to register plugin in isolation Mode - "None"?


    Thanks, Rajeev

    Thursday, November 8, 2012 3:02 PM
  • Hi,

    plugins in CRM Online must be registered in Sandbox isolation mode. Why are you using Isolation Mode - None anyway in your source system?

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.


    Thursday, November 8, 2012 3:05 PM
  • Hi Pavlos,

    Thanks for your fast reply.

    When I am registering my plugin in None Isolation Mode, it is working fine.

    But when I am registering my plugin in Sandbox Isolation Mode in Source system(IFD) it is giving error.

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #816BCFDEDetail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #816BCFDE</Message>
      <Timestamp>2012-11-09T05:37:43.7474609Z</Timestamp>
      <InnerFault>
        <ErrorCode>-2147220956</ErrorCode>
        <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
        <Message>Unexpected exception from plug-in (Execute): HP.IP.BingMap.PreHPBingMapCreateDelete: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</Message>
        <Timestamp>2012-11-09T05:37:43.7474609Z</Timestamp>
        <InnerFault i:nil="true" />
        <TraceText>

    [HP.IP.BingMap: HP.IP.BingMap.PreHPBingMapCreateDelete]
    [3dbdeb38-8918-e211-9e7c-080027f61b75: HP.IP.BingMap.PreHPBingMapCreateDelete: Delete of hp_hpbingmaps]


    </TraceText>
      </InnerFault>
      <TraceText i:nil="true" />
    </OrganizationServiceFault>


    Thanks, Rajeev

    Friday, November 9, 2012 5:42 AM
  • Hi Pavlos,

    Even I tried the following

    http://social.microsoft.com/Forums/en/crmdevelopment/thread/fcdb4ec9-adc3-4144-8db2-294c104f550e

    but still the above error is coming.


    Thanks, Rajeev

    Friday, November 9, 2012 5:48 AM
  • Hi,

    it looks like in your code in your plugins you are taking actions that can only be taken in a non-sandboxed plugin. This is causing the security exceptions. In order to be able to register your plugin in the sandbox you will have to come up with some workaround for the code that is causing these issues.

    In order to find out which code causes the security restrictions you can take a look here or here. Examples of such unsupported actions in a sandboxed plugin are access to the file system, calling a service via "localhost" or via an IP address etc. etc.

    Please try to find the code that causes these issues or post your code so that we can identify the problem.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    • Marked as answer by CRM Rajeev Friday, November 9, 2012 8:42 AM
    Friday, November 9, 2012 8:04 AM
  • Hi Palvos,

    Great, you identified the problem.

    I am using System.IO.Path.GetTempPath() gor storing the zipped solution in my path.

    Can you suggest some work around to store the zipped solution in the path.


    Thanks, Rajeev

    Friday, November 9, 2012 8:44 AM
  • Hi,

    I don't think you can access the file system at all using a sandboxed plugin. Which means you cannot accomplish storing the zipped file on the file system of the server. Maybe you can find some workaround for this, an idea would be for example to create a custom entity with notes enabled and store the zip file as an attachment to a record of that entity (and of course configure security for the custom entity accordingly). 

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Friday, November 9, 2012 8:57 AM
  • Thanks Pavlos,

    Can you please provide som sample code to attach file to the Notes enabled entity.


    Thanks, Rajeev

    Friday, November 9, 2012 10:19 AM
  • Hi,

    you can use something like this:

    var note = new Entity("annotation");
    note["subject"] = "Note Title";
    note["filename"] = "My File Name";
    note["documentbody"] = Convert.ToBase64String(File.ReadAllBytes("path to file"));
    note["mimetype"] = "application/zip";
    note["objectid"] = new EntityReference("custom entity logical name", customEntityId);
    service.Create(note);

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Friday, November 9, 2012 10:40 AM
  • Thanks Pavlos,

    Here I am exporting the solution zip file and changing the entity form section programatically.

    For this the solution.zip file need to be in physical path.

    For this I am using System.IO which it seems is not supported in "Sanbox" - Isolation mode.


    Thanks, Rajeev

    Friday, November 9, 2012 3:14 PM
  • Hi,

    a way to achieve this would be to add the solution file as an embedded resource in your plugin class library project and read the solution file from the resource stream. This way you won't have to read it from the physical path.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
    View my latest gallery contribution here.
    Visit my blog here.

    Friday, November 9, 2012 3:37 PM