Dynamics CRM

GetCrmService method:

        private MyCrmService.CrmService GetCrmService()
        {
            /*
            // Setup the Authentication Token
            MyCrmService.CrmAuthenticationToken token = new MyCrmService.CrmAuthenticationToken();
            token.OrganizationName = "crm";

            MyCrmService.CrmService crmService = new MyCrmService.CrmService();
            crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            crmService.CrmAuthenticationTokenValue = token;
            */
            // Set up the CRM Service.
            MyCrmService.CrmAuthenticationToken token = new MyCrmService.CrmAuthenticationToken();
            token.AuthenticationType = 0;
            token.OrganizationName = "ps";// 该名字为安装Crm4.0指定组织名称时填写的

            MyCrmService.CrmService service = new MyCrmService.CrmService();
            service.Url = "http://ps:5555/mscrmservices/2007/crmservice.asmx%22;// 这个必须写
            service.CrmAuthenticationTokenValue = token;
            service.Credentials = System.Net.CredentialCache.DefaultCredentials;


            return service;
        }

plus register tool by ip address when UnAthourized error

plus register assembly first, and next register new step

debug attach w3wp.exe

for workflow, use

can u paste your workflow actvity code or at least signature, it should look like this. did you specify the CrmWorkflowActivity attribute? also the assembly must be signed. also make sure the class is public

[CrmWorkflowActivity("Create User", "My Group")]
 public partial class TestActivity: SequenceActivity
 {
      protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
  {
}
}


原文地址:https://www.cnblogs.com/lingdanglfw/p/2517983.html