/// <summary>
 /// Register server service
 /// </summary>
 /// <param name="serviceType"></param>
 /// <param name="name">custom service name when servie hasn't attribute</param>
 public void RegisterServerService(Type serviceType, string name = null)
 {
     if (serviceType.HasServiceAttribute())
     {
         ServiceContractAttribute[] services = serviceType.GetServiceContractAttributes();
         foreach (ServiceContractAttribute service in services)
         {
             name = service.GetServiceName(false).ToLower();
             if (!RegisteredServiceTypes.ContainsKey(name))
             {
                 RegisteredServiceTypes.TryAdd(name, serviceType);
             }
         }
     }
     else if (!string.IsNullOrEmpty(name))
     {
         if (!RegisteredServiceTypes.ContainsKey(name))
         {
             RegisteredServiceTypes.TryAdd(name, serviceType);
         }
         else
         {
             throw new Exception($"service name {name} exist!");
         }
     }
     else
     {
         throw new Exception("service name is null or empty!");
     }
 }
        public void RegisterClientService(Type serviceType)
        {
            ServiceContractAttribute service = serviceType.GetClientServiceAttribute();

            if (service != null)
            {
                string name = service.GetServiceName(false).ToLower();
                if (!RegisteredServiceTypes.ContainsKey(name))
                {
                    RegisteredServiceTypes.TryAdd(name, serviceType);
                }
            }
            else
            {
                throw new NotSupportedException("your service is not type of ServerService or HttpService or StreamService");
            }
        }