Skip to main content

Hi All,


I am new to K2 blackperl, today I just started my development. When I try connection code using C#. I am getting the following error. Please help me to resolve this error.


ClientException was unhandled
  Message=Unable to resolve address Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=THHOUDVBLDK2SVR;Port=5555;SecurityLabelName=K2;WindowsDomain=CORPDOMAIN;UserID=CORPDOMAINe-KThack;Password=India1 and port 5252. No such host is known.
  Source=SourceCode.Workflow.Client
  StackTrace:
       at SourceCode.Workflow.Client.SocketClient.InternalConnect(String server, String port, Int32 timeout, Int32 ipversion)
       at SourceCode.Workflow.Client.SocketClient.Connect(StringDictionary Data)
       at SourceCode.Workflow.Client.InternalConnection.Connect(StringDictionary Data)
       at SourceCode.Workflow.Client.Connection.Open(String Server)
       at K2Experiment.K2Connection.getConnection() in F:BalajiVisualStudioProjectK2ExperimentK2ExperimentK2Connection.cs:line 32
       at K2Experiment.K2Program.Main(String ] args) in F:BalajiVisualStudioProjectK2ExperimentK2ExperimentK2Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(Assembly assembly, Stringn] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, Stringi] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:



The below is the Source code I tried.


public void getConnection()
        {
            Console.WriteLine("Control in K2 Connection Class");
            // Declare new K2 Connection & ProcessInstance objects
            Connection conn = new Connection();
            //Connect to Workflow Server
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            builder.Authenticate = true;
            builder.Host = "HOSTNAME";           
            builder.Port = 5555;
            builder.Integrated = true;
            builder.IsPrimaryLogin = true;
            builder.SecurityLabelName = "K2";
            builder.WindowsDomain = "DOMAIN";
            builder.UserID = "DOMAINUSERNAME";
            builder.Password = "PASSWORD";
          
            conn.Open(builder.ConnectionString);
            Console.WriteLine("After Open connection");
            Console.ReadLine();
            //Create process instance
            string name = @"Information Request WorkflowInformation Request";
            ProcessInstance pi = conn.CreateProcessInstance(name);
            // Map the data to the K2 process data fields
            pi.DataFields<"Request ID"].Value = "";
            pi.DataFields "Customer Name"].Value = "";
            pi.DataFieldst"Customer Email"].Value = "";
            // Set the folio
            // Start K2 process instance
            conn.StartProcessInstance(pi);
            // Close Connection
            conn.Close();
            Console.WriteLine("Connection opened successful");
        }



Thanks& Regards,


-Balaji.S

Hi,


It seems as though the machine name "THHOUDVBLDK2SVR" cannot be resolved from the machine executing the code. It might be a network-related problem.


I would start by trying to ping this host name from the machine where you are running this code. If the name cannot be resolved it will point you to a DNS or other network-related error which you should troubleshoot with your network administrators.


Also check whether port 5252 is open in the Windows Firewall of the K2 machine.


I hope you can find the error and correct it.


Regards,


Reply