private Task <ChainCodeInvokeResponse> ChaincodeInvoke(IChaincodeStub stub) { try { var chaincode = new Chaincode(); chaincode.NameSpace = stub.GetChaincodeNameSpace(); chaincode.Name = stub.GetChaincodeName(); chaincode.Version = stub.GetChaincodeVersion(); var ass = _assemblyProvider.GetAssembly(stub.GetChannelId(), stub.GetChaincodeName(), stub.GetChaincodeNameSpace(), stub.GetChaincodeVersion()); var classfullname = chaincode.NameSpace + "." + chaincode.Name; //必须使用 名称空间+类名称 var type = ass.GetType(classfullname); //方法的名称 MethodInfo method = type.GetMethod("Invoke"); //必须使用名称空间+类名称 var obj = ass.CreateInstance(classfullname); var rs = method.Invoke(obj, new object[] { stub }); if (rs != null) { return(Task.FromResult((ChainCodeInvokeResponse)rs)); } } catch (Exception ex) { return(null); } return(null); }