locked
CRM 4.0 Plugin registration tool 2.0 RRS feed

  • Question

  • Hi,

     

    I've been over this for the last two days and I'm not sure what I'm doing wrong.

     

     I used the plugin registeration tool 2.0 to register the sample code assembly that comes with the tool but I keep getting the following error: "Requested registery access is not allowed" everytime I create the entity and nothing gets created.

     
    In the event viewer, the following message appear:

    Web Service Plug-in failed in OrganizationId: 70fe0f1b-0eff-dc11-aaaa-0003fffdffff; SdkMessageProcessingStepId: 50608622-902d-dd11-aa5a-0003fffdffff; EntityName: account; Stage: 50; MessageName: Update; AssemblyName: Microsoft.Crm.Sdk.Walkthrough.AccountCreateHandler, Microsoft.Crm.Sdk.Walkthrough.AccountCreatePlugin, Version=1.0.0.0, Culture=en-US, PublicKeyToken=4406fa73b5445f20; ClassName: Microsoft.Crm.Sdk.Walkthrough.AccountCreateHandler; Exception: Unhandled Exception: System.Security.SecurityException: Requested registry access is not allowed.
     Any idea where am going wrong?
     
    All I did is built the assembly, registered the assembly, then registered a step, then registered an image and finally tried to update the account entity as per the document provided with the registration tool!
     
    It should be noted that I am using CRM 4.0 virtual pc and I have about four different organisation. Initially, the tool did not work so I modified the tool's code to allow me to see all the organisation then when I had the above problem, I removed my changes and disabled all organisation, I was then able to use the tool to register the assembly but the above error kept coming up.
     
    Any idea or help would highly be appreciated.
     
    Thank you.
     
    Thursday, May 29, 2008 9:21 PM

Answers

  • Hi Kamal,

    You can't write to registry because the service (NETWORK SERVICE) hasn't got the permission to do so.

    You'll need to access the regedit and traverse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog.

    Once you're there, You'll need to right click on EventLog and then proceed to Permissions.  Make sure that NETWORK SERVICE (Account which CRM runs on typically) is on the list and has Full Control.  Once you've achieved that, run your Plug-in again.

    Although, from what I can tell it seems like you're trying to debug your plug-in.  I'd recommend you going through the SDK to find out on how to run the plug-in in debug mode.  (real quick though, compile plug-in > press alt + 'd' > press 'p' > press 'w' (this will take you to w3wp.exe, if not refresh the ie) > run codes from )

    Hong

    HT
    Wednesday, March 11, 2009 2:46 AM

All replies

  • What is leading you to believe the registration is bad?  It looks like your code is being invoked and it is hitting an unhandled exception.  Are you trying to read the registry in your code?

     

    Thursday, May 29, 2008 10:54 PM
    Moderator
  • I did not say the registration is bad. I believe that there is something that I need to do which I am not doing and is not mentioned anywhere on the guide provided by the tool.

     

    Or it could be how this VPC is configured.

     

    I'm not doing anything especial. I took the sample code that came with the tool, "accountcreateplugin" and register it using the guide provided step by step.

     

    I am logged in as a local administrator but  kinda remember someone discussing registery keys and a need to chage something, I am not sure.

     

    I could not even debug the code. any help on how to debug the code would also be appreciated.

     

    Thank you.

     

    Friday, May 30, 2008 10:06 AM
  • Can you post your code ? A common casue of this error is if you're trying to write to the event log.

     

    To debug a plugin, you have to copy the .pdb file to the Program Files\Microsoft CRM\server\bin\assembly directory, and attach to the w3wp.exe process within Visual Studio

     

    Sunday, June 1, 2008 3:37 PM
    Moderator
  • I am writing to the windows event log in my plugin, and I am getting this error.  What registry keys are read/written when writing to the windows event log?

     

    Thanks,

     

    Pete

    Tuesday, August 19, 2008 4:26 PM
  • Hi David,

    I am also gettng same error in Event Viwer when i am creating and sending Email actitvity using SDK 4.0, I am able to create an Email activity in CRM but not able to send email. Find below code for the same. If i am worng plz. Let me replay

    public void Execute(IPluginExecutionContext context)
          {
              try
              {


              CrmAuthenticationToken token = new CrmAuthenticationToken();
              token.AuthenticationType = 0;

              token.OrganizationName = "OctawareTest3";
              CrmService service = new CrmService();

              service.Url = "http://srv-3:5555/MSCrmServices/2007/CrmService.asmx";
              service.CrmAuthenticationTokenValue = token;

              service.Credentials = System.Net.CredentialCache.DefaultCredentials;

             // CrmService service = new CrmService();
              email em = new email();

              activityparty fromparty = new activityparty();
              fromparty.partyid = new Lookup();
              fromparty.partyid.type = EntityName.systemuser.ToString(); //Change to some other entity if needed.
              fromparty.partyid.Value = new Guid("EC9BBCA5-F736-DD11-8C9F-001AA0B87735");
              em.from = new activityparty[] { fromparty };

              activityparty toparty = new activityparty();
              toparty.partyid = new Lookup();
              toparty.partyid.type = EntityName.contact.ToString(); //Change to some other entity if needed
              toparty.partyid.Value = new Guid("7E1D2265-404F-DD11-96CB-001AA0B87735");
              em.to = new activityparty[] { toparty };

              em.subject = "Subject - 100";
              em.sender = "wasekh@octaware.com";

              em.regardingobjectid = new Lookup();
              em.regardingobjectid.type = EntityName.contact.ToString();
              em.regardingobjectid.Value = new Guid("7E1D2265-404F-DD11-96CB-001AA0B87735");
              em.description = "Body-Send Email to Wasekh";

              em.ownerid = new Owner();
              em.ownerid.type = EntityName.systemuser.ToString();
              em.ownerid.Value = new Guid("EC9BBCA5-F736-DD11-8C9F-001AA0B87735");//A3BEC25E-0E39-DD11-A22F-001D09435F87
             
              Guid guidEmail = service.Create(em);


              ///////////

              //CrmBoolean direction = new CrmBoolean();
              //direction.Value = true;
              //em.directioncode = direction;

              //TargetCreateEmail targetCreate = new TargetCreateEmail();
              //targetCreate.Email = em;

              //CreateRequest request = new CreateRequest();
              //request.Target = targetCreate;

              //CreateResponse response = (CreateResponse)service.Execute(request);
              //Guid createdEmailGuid = response.id;
              //Guid createdEmailGuid = new Guid("68EAA729-4F80-DD11-97CB-001D09435F87");



              GetTrackingTokenEmailRequest getTrackingToken = new GetTrackingTokenEmailRequest();

              getTrackingToken.Subject = em.subject;
              GetTrackingTokenEmailResponse getTrackingTokenResponse = (GetTrackingTokenEmailResponse)service.Execute(getTrackingToken);


              SendEmailRequest req = new SendEmailRequest();
              req.EmailId = guidEmail;
             req.TrackingToken = getTrackingTokenResponse.TrackingToken;
              //req.TrackingToken = String.Empty;
              req.IssueSend = true;
             


                  //// Send the email message.
                  SendEmailResponse res = (SendEmailResponse)service.Execute(req);
                  //Response responce = service.Execute(req);
              }
              catch (System.Web.Services.Protocols.SoapException ex)
              {
                  throw ex;
                  //TextWriter log = TextWriter.Synchronized(File.AppendText(@"C:\temp\CRMerror.txt"));
                  //log.WriteLine("SoapException: " + DateTime.Now.ToString());
                  //log.WriteLine("Error Message: " + ex.Detail.InnerText);
                  //XmlDocument error = new XmlDocument();
                  //error.LoadXml(ex.Detail.InnerXml);
                  //log.WriteLine("Error Code: " + error.SelectSingleNode("/error/code").InnerText);
                  //log.WriteLine("Error Description: " + error.SelectSingleNode("/error/description").InnerText);
                  //log.WriteLine("Error Type: " + error.SelectSingleNode("/error/type").InnerText);
                  //log.WriteLine();
                  //log.Close();
              }

          }

    Thanks.
    Saturday, September 13, 2008 6:40 AM
  • Hi Kamal,

    You can't write to registry because the service (NETWORK SERVICE) hasn't got the permission to do so.

    You'll need to access the regedit and traverse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog.

    Once you're there, You'll need to right click on EventLog and then proceed to Permissions.  Make sure that NETWORK SERVICE (Account which CRM runs on typically) is on the list and has Full Control.  Once you've achieved that, run your Plug-in again.

    Although, from what I can tell it seems like you're trying to debug your plug-in.  I'd recommend you going through the SDK to find out on how to run the plug-in in debug mode.  (real quick though, compile plug-in > press alt + 'd' > press 'p' > press 'w' (this will take you to w3wp.exe, if not refresh the ie) > run codes from )

    Hong

    HT
    Wednesday, March 11, 2009 2:46 AM