当前位置: 首页>>代码示例>>C#>>正文


C# ServiceClient.Close方法代码示例

本文整理汇总了C#中ServiceClient.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient.Close方法的具体用法?C# ServiceClient.Close怎么用?C# ServiceClient.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceClient的用法示例。


在下文中一共展示了ServiceClient.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Index

 // GET: Match
 public ActionResult Index()
 {
     ServiceClient webService = new ServiceClient();
     ViewBag.Matchs = webService.GetMatchs();
     webService.Close();
     return View();
 }
开发者ID:JulienUsson,项目名称:JediTournament,代码行数:8,代码来源:MatchController.cs

示例2: Index

 // GET: Game
 public ActionResult Index()
 {
     ServiceClient webService = new ServiceClient();
     ViewBag.Tournois = webService.GetTournois().Select(t => new SelectListItem { Text = t.Nom, Value = t.ID.ToString()});
     webService.Close();
     return View();
 }
开发者ID:JulienUsson,项目名称:JediTournament,代码行数:8,代码来源:GameController.cs

示例3: WorkflowExtensionsBehaviorAddsExtension

        public void WorkflowExtensionsBehaviorAddsExtension()
        {
            WorkflowServiceTestHost host = null;

            // TODO: Test with multiple extensions
            // TODO: Test with bad config file entries
            var serviceEndpoint1 = ServiceTest.GetUniqueEndpointAddress();
            using (host = WorkflowServiceTestHost.Open("ServiceExtensionTest.xamlx", serviceEndpoint1))
            {
                try
                {
                    var proxy = new ServiceClient(ServiceTest.Pipe, serviceEndpoint1);
                    try
                    {
                        proxy.GetData(1);
                        proxy.Close();
                    }
                    catch (Exception)
                    {
                        proxy.Abort();
                        throw;
                    }
                }
                finally
                {
                    if (host != null)
                    {
                        host.Tracking.Trace();
                    }
                }
            }
        }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:32,代码来源:WorkflowExtensionsBehaviorTest.cs

示例4: Register

        public string Register(Empleado emp)
        {
            ServiceClient service = new ServiceClient();

            service.CreateUser(emp);

            service.Close();

            return "Se ha creado el usuario con exito";
        }
开发者ID:rNexeR,项目名称:Vacation-System,代码行数:10,代码来源:AccountPageController.cs

示例5: Bet

 public ActionResult Bet(string Tournois)
 {
     ServiceClient webService = new ServiceClient();
     TournoiContract tournoi= webService.GetTournoi(int.Parse(Tournois));
     var jedis= tournoi.Matchs.Select(m => m.Jedi1).Union(tournoi.Matchs.Select(m => m.Jedi2));
     ViewBag.Tournoi = tournoi;
     ViewBag.Jedis = jedis.Select(t => new SelectListItem { Text = t.Nom, Value = t.ID.ToString() });
     webService.Close();
     return View();
 }
开发者ID:JulienUsson,项目名称:JediTournament,代码行数:10,代码来源:GameController.cs

示例6: Result

 public ActionResult Result(string Tournoi, string Jedis)
 {
     ServiceClient webService = new ServiceClient();
     Random rdm = new Random();
     ViewBag.Tournoi = webService.GetTournoi(int.Parse(Tournoi));
     ViewBag.Jedi = webService.GetJedi(int.Parse(Jedis));
     ViewBag.HasWin = (rdm.Next(2)==1);
     webService.Close();
     return View();
 }
开发者ID:JulienUsson,项目名称:JediTournament,代码行数:10,代码来源:GameController.cs

示例7: ParseSimilarity

 public static double ParseSimilarity(string File1, string File2)
 {
     // Create client
     ServiceClient WZNTServices = new ServiceClient();
     double Similarity = WZNTServices.ParseSimilarity(File1, File2);
     Log.Info(string.Format("Images have {0} of similarity", Similarity));
     // Close the client.
     WZNTServices.Close();
     return Similarity;
 }
开发者ID:pgemeo,项目名称:WZNT,代码行数:10,代码来源:ImageParser.cs

示例8: Test1

        static void Test1()
        {
            var client = new ServiceClient();
            for (int i = 0; i < 3; i++) {

                var i1 = i;
                Task.Factory.StartNew(() => {
                    Console.WriteLine(string.Format("-------------开始-------------{0}-{1}----------------------------", i1, DateTime.Now));
                    //using () {
                        double value1 = 100.00D;
                        double value2 = 15.99D;
                        double result = client.Add(value1, value2);
                        Console.WriteLine(string.Format("--------------结束------------{0}-{1}-----{2}-----------------------", i1, DateTime.Now, result));
                        //client.Close();
                    //}

                });

            }
            Thread.Sleep(9000);
            using (var client1 = new Online.ClientTest.ServiceReference2.Service1Client()) {
                double value1 = 100.00D;
                double value2 = 15.99D;
                Console.WriteLine(string.Format("-------------开始01-------------{0}-{1}----------------------------", "1111", DateTime.Now));
                double result = client1.Subtract(value1, value2);
                Console.WriteLine(string.Format("--------------结束01------------{0}-{1}-----{2}-----------------------", result, DateTime.Now, result));
                client.Close();
            }
            //for (int i = 0; i < 100; i++) {
            //    var i1 = i;
            //    Task.Factory.StartNew(() => {
            //        Console.WriteLine(string.Format("-------------开始-------------{0}-{1}----------------------------", i1, DateTime.Now));
            //        using (var client = new OauthClient()) {
            //            double value1 = 100.00D;
            //            double value2 = 15.99D;
            //            var result = client.Code("2345");
            //            Console.WriteLine(string.Format("--------------结束------------{0}-{1}-----{2}-----------------------", i1, DateTime.Now, result));
            //        }

            //    });

            //}

            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
            //using (var client = new ServiceClient()) {
            //    double value1 = 100.00D;
            //    double value2 = 15.99D;
            //    double result = client.Add(value1, value2);
            //    Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
            //    Console.WriteLine("Press <ENTER> to terminate client.");
            //    Console.ReadLine();
            //}
        }
开发者ID:tengwei,项目名称:TwApplication,代码行数:54,代码来源:Client.cs

示例9: Main

        static void Main()
        {
            ServiceClient client = new ServiceClient();
            client.Start();

            Console.WriteLine("Activating Durable Delay Service");
            Console.WriteLine("Done - see C:\\WFDurableDelaySampleResult.txt");
            Console.WriteLine("Press <ENTER> to exit.");
            Console.ReadLine();

            client.Close();
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:12,代码来源:Program.cs

示例10: Departments

        public RedirectToRouteResult Departments(DepartamentoMirror departamentoMirror)
        {
            if(departamentoMirror.Descripcion == null)
                return RedirectToAction("Departments");

            ServiceClient service = new ServiceClient();
            departamentoMirror.Activo = true;

            service.CreateDepartment(departamentoMirror);

            service.Close();

            return RedirectToAction("Departments");
        }
开发者ID:rNexeR,项目名称:Vacation-System,代码行数:14,代码来源:AccountPageController.cs

示例11: Index

        public RedirectToRouteResult Index(LoginModel log)
        {
            ServiceClient service = new ServiceClient();

            Empleado emp = service.LogIn(log.Email, log.Password);

            if (emp != null)
            {
                Session["User"] = emp;
                return RedirectToAction("Dashboard", "AccountPage");
            }

            Session["User"] = null;

            service.Close();
            return RedirectToAction("Index");
        }
开发者ID:rNexeR,项目名称:Vacation-System,代码行数:17,代码来源:LogInController.cs

示例12: ButtonSubmit_Click

 protected void ButtonSubmit_Click(object sender, EventArgs e)
 {
     var proxy = new ServiceClient();
     try
     {
         var sampleResponse = proxy.GetData(TextBoxKey.Text);
         LabelValue.Text = sampleResponse.Data.Value;
         RadioButtonHit.Checked = sampleResponse.CacheHit;
         RadioButtonMiss.Checked = !sampleResponse.CacheHit;
         proxy.Close();
     }
     catch (Exception)
     {
         proxy.Abort();
         throw;
     }
 }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:17,代码来源:Default.aspx.cs

示例13: asyncsyncOperation

        public static void asyncsyncOperation()
        {
            ServiceClient client = new ServiceClient("WSHttpBinding_IService");
            Data s1 = new Data() { name = "saeid1" };
            Data s2 = new Data() { name = "saeid2" };
            client.addData(s1);
            client.addData(s2);

            //client.getListCompleted += new EventHandler<getListCompletedEventArgs>(client_getListCompleted);
            //client.getListAsync();

            Console.WriteLine("waiting");

            //waits till finishes
            client.Close();
            //aborts no matter not completed
            //client.Abort();
        }
开发者ID:saeidghoreshi,项目名称:partition1,代码行数:18,代码来源:Program.cs

示例14: Diagnose

 static void Diagnose(int selection)
 {
     ServiceClient client = new ServiceClient();
     string rtn = "";
     if (selection == 1)
         rtn = client.DiagnoseStart();
     else if (selection == 2)
         rtn = client.DiagnoseAC();
     Console.WriteLine(rtn);
     bool input;
     while (!rtn.ToLower().Contains("diagnosis complete"))
     {
         input = GetInput();
         rtn = client.NextStep(input);
         Console.WriteLine(rtn);
     }
     client.Close();
     client.ChannelFactory.Close();
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:19,代码来源:Program.cs

示例15: Main

        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

            InstanceContext site = new InstanceContext(null, new Program());
            _client = new ServiceClient(site);
            //Subscribe.
            Console.WriteLine("Subscribing");
            _client.Subscribe();

            Console.WriteLine();

            Console.WriteLine("Press ENTER to unsubscribe and shut down client");
            Console.ReadLine();

            Console.WriteLine("Unsubscribing");
            _client.Unsubscribe();

            //Closing the client gracefully closes the connection and cleans up resources
            _client.Close();
        }
开发者ID:viniciussalmeida,项目名称:StockTrading,代码行数:21,代码来源:Program.cs


注:本文中的ServiceClient.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。