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


C# ServiceReference1.Service1Client.GetData方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

            try
            {
                string retorno = client.GetData(1232);

                Console.WriteLine(retorno);
            }
            catch (EndpointNotFoundException e)
            {
                Console.WriteLine("Servidor desligado");
            }
            catch (Exception e)
            {
                Console.WriteLine("Deu algo errado");
            }
            finally
            {
                Console.WriteLine("Finalizou");
            }

            Console.Read();
        }
开发者ID:TiagoSoczek,项目名称:MOC,代码行数:25,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            // client config..

            ServiceReference1.Service1Client myClient = new ServiceReference1.Service1Client();
            try
            {

                myClient.Open();

                for (int x = 2; x < 12; x++)
                {
                    Console.WriteLine(myClient.GetData(x));
                    Thread.Sleep(1000);
                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("Stack Trace======================");
                Console.WriteLine(e.StackTrace);
            }


            myClient.Close();


        }
开发者ID:ehershey,项目名称:development,代码行数:28,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            ServiceReference1.Service1Client SvcProxy = new ServiceReference1.Service1Client("tcpWcfSvcLib1EP");
            SvcProxy.Open();

            //2,147,483,647
            byte[] valuesBytes;
            valToTransfer[] mivs = null;

            for (int x = 0; x < TEST_COUNT; x++)
            {
                DateTime startTime = DateTime.Now;
                valuesBytes = SvcProxy.GetData();
                mivs = HandDeserialize(valuesBytes);
                DateTime endTime = DateTime.Now;
                TimeSpan ts = new TimeSpan(endTime.Ticks - startTime.Ticks);
                aggregateMilliseconds += ts.Milliseconds;

                Console.WriteLine("time for call:[" + ts.Milliseconds + "]");
                Console.WriteLine("size of data passed [" + valuesBytes.Length + "]");
                Console.WriteLine("packet number[" + mivs[0].struct2_data_len + "]"); // hijacked for testing purposes..
                Console.WriteLine("500th item audit[" + mivs[499].struct1_ulong1 + "]");
                Console.WriteLine("9000th item audit[" + mivs[8999].struct1_ulong1 + "]");
            }
            Console.WriteLine("avg time per call [" + aggregateMilliseconds/TEST_COUNT + "]");

            SvcProxy.Close();
        }
开发者ID:ehershey,项目名称:development,代码行数:28,代码来源:Program.cs

示例4: Main

 static void Main(string[] args)
 {
     var client = new ServiceReference1.Service1Client();
     var result = client.GetData(5);
     Console.WriteLine(result);
     Console.ReadLine();
 }
开发者ID:bigfont,项目名称:hello-wcf,代码行数:7,代码来源:Program.cs

示例5: Main

        static void Main(string[] args)
        {
            using (var proxy = new ServiceReference1.Service1Client())
            {
                Console.WriteLine(proxy.GetData(1999));
            }

            Console.ReadLine();
        }
开发者ID:fnalin,项目名称:WCFHelloWorld,代码行数:9,代码来源:Program.cs

示例6: onClick

        private void onClick(object sender, RoutedEventArgs e)
        {
            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
            var c = client.GetData(0);

            //How do i get the dictionary object here?
            //foreach(var t in c.StringValue)
            //    listBox.Items.Add("");
        }
开发者ID:ajaysbritto,项目名称:mcve,代码行数:9,代码来源:MainWindow.xaml.cs

示例7: btnMessage_Click

        private void btnMessage_Click(object sender, EventArgs e)
        {
            if (client.State == CommunicationState.Faulted)
            {
                client = new Service1Client();
            }

            client = new Service1Client("NetTcpBinding_IService1");
            client.GetData(4);
        }
开发者ID:Montagu-Evans,项目名称:WCF,代码行数:10,代码来源:Form1.cs

示例8: sendBtn_Click

        private void sendBtn_Click(object sender, RoutedEventArgs e)
        {
            string message = messageTbx.Text;

            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

            var response = client.GetData(message);

            responseTbl.Text = responseTbl.Text + "\n" + response;
        }
开发者ID:vva-thermo,项目名称:WcfTestHost,代码行数:10,代码来源:MainWindow.xaml.cs

示例9: Main

        private static void Main(string[] args)
        {
            using (var client = new ServiceReference1.Service1Client())
            {
                var result = client.GetData(1);
                Console.WriteLine(result);

                Console.Read();
            }
        }
开发者ID:DerekLoveCC,项目名称:WCF,代码行数:10,代码来源:Program.cs

示例10: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //Így lehet a WCF Service-t meghívni a legegyszerűbben :
            ServiceReference1.Service1Client c = new ServiceReference1.Service1Client();
            textBox1.Text = c.GetData(10).ToString();

            //Vagy lehet használni az app.config-ban megadott interface-i is:
            ServiceReference1.IService1 c2 = new ServiceReference1.Service1Client();
            textBox1.Text = c2.GetData(10).ToString();
        }
开发者ID:kathib,项目名称:WCF_WebServices_2,代码行数:10,代码来源:Form1.cs

示例11: Main

 static void Main(string[] args)
 {
     var client = new ServiceReference1.Service1Client();
     client.ClientCredentials.UserName.UserName = "Tony";
     client.ClientCredentials.UserName.Password = "abc";
     client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
     var value = client.GetData(77);
     Console.WriteLine(value);
     Console.ReadLine();
 }
开发者ID:umutsenoglu,项目名称:wcfauthcert,代码行数:10,代码来源:Program.cs

示例12: Main

        static void Main(string[] args)
        {
            using (ServiceReference1.Service1Client service = new ServiceReference1.Service1Client("WSHttpBinding_IService1"))
            {

                Console.WriteLine("尝试调用 service.GetData(1)");
                service.GetData(1);

                // 尝试成功执行一次.
                Console.WriteLine("尝试调用 service.TestInsertData(5, FIVE, 5, FIVEFIVE)");
                service.TestInsertData(5, "FIVE", 5, "FIVEFIVE");

                Console.WriteLine("去数据库查询一下,看看数据是否已经进入数据库! 按回车键删除数据!");
                Console.ReadLine();

                Console.WriteLine("尝试调用 service.TestDeleteData(5)");
                // 清理数据.
                service.TestDeleteData(5);

                try
                {
                    // 尝试使处理失败!
                    // 因为 主表有数据为 id 为 1 与 2 的。  子表数据也是有  id 为 1 与 2 的。
                    // 在 WCF 服务中, 先插入 id=10 的主表,将成功, 然后插入 id = 1 的子表, 将失败。
                    // 操作完毕后, 需要去数据库核对。
                    // 确保没有 id=10 的主表数据.
                    Console.WriteLine("尝试调用 service.TestInsertData(10, testM, 1, TESTS)");
                    service.TestInsertData(10, "TestM", 1, "TESTS");
                }
                catch (FaultException ex)
                {
                    Console.WriteLine("调用 WCF 服务发生异常! {0}: {1}", ex.Code.Name, ex.Reason);
                }

                try
                {
                    // 尝试使处理失败!
                    // 因为 主表有数据为 id 为 1 与 2 的。  子表数据也是有  id 为 1 与 2 的。
                    // 在 WCF 服务中, 先插入 id=20 的主表,将成功, 然后插入 id = 1 的子表, 将失败。
                    // 操作完毕后, 需要去数据库核对。
                    // 确保没有 id=10 的主表数据.
                    Console.WriteLine("尝试调用 service.TestInsertAll(10, TestM20, 1, TESTS)");
                    service.TestInsertAll(20, "TestM20", 1, "TESTS");
                }
                catch (FaultException ex)
                {
                    Console.WriteLine("调用 WCF 服务发生异常! {0}: {1}", ex.Code.Name, ex.Reason);
                }

                Console.WriteLine("按回车键结束!");
                Console.ReadLine();
            }
        }
开发者ID:mahuidong,项目名称:my-csharp-sample,代码行数:53,代码来源:Program.cs

示例13: Main

        static void Main(string[] args)
        {
            // create a new instance of the service
            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

            // read in the user input and then feed it to the wcf service
            String str = Console.ReadLine();
            Console.WriteLine(client.GetData(str));

            Console.WriteLine("\n\npress any key to continue...");
            Console.ReadKey();
        }
开发者ID:jbijoux,项目名称:70-484,代码行数:12,代码来源:Program.cs

示例14: Main

 static void Main(string[] args)
 {
     ServicePointManager.ServerCertificateValidationCallback =
     ((sender, certificate, chain, sslPolicyErrors) => ServerCertificateValidate(sender, certificate, chain, sslPolicyErrors));
     //ServicePointManager.ServerCertificateValidationCallback =
     //((sender, certificate, chain, sslPolicyErrors) => true);
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     var obj = client.GetData(10);
     var jb = client.GetString("Antony");
     client.Close();
     Console.Read();
 }
开发者ID:antonysamy931,项目名称:WCF-WsHttpBinding,代码行数:12,代码来源:Program.cs

示例15: Main

        static void Main(string[] args)
        {
            var client = new ServiceReference1.Service1Client();

            if (false /* below is how to add the behavior in through code */)
            {
                client.Endpoint.Behaviors.Add(new DebugMessageBehavior());
            }

            var result = client.GetData(7);

            Console.WriteLine(result);
            Console.ReadLine();
        }
开发者ID:WestDiscGolf,项目名称:WcfMessageDebugging,代码行数:14,代码来源:Program.cs


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