コード例 #1
0
ファイル: WcfServiceHelper.cs プロジェクト: nfox-lz/NetCache
        public static async Task Execute(ServiceAction <Task> action)
        {
            using (var service = new Server.NetCacheServiceClient())
                try
                {
                    service.Open();
                    //service.ClientCredentials.UserName.UserName = "******";
                    //service.ClientCredentials.UserName.Password = "******";

                    await action(service);
                }
                catch (Exception exception)
                {
                    //Logging.LogHelper.Logger.LogException(exception);
                }
            finally
            {
                if (service.State == CommunicationState.Opened)
                {
                    service.Close();
                }
            }
        }