Example #1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            BasicHttpBinding pBinding = new BasicHttpBinding();

            pBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            pBinding.Security.Mode = BasicHttpSecurityMode.None;

            EncyclopediaServiceClient pClient =
                new EncyclopediaServiceClient(
                    pBinding,
                    new EndpointAddress(txtAddr.Text));

            EncyclopediaType pEncyclopediaType = pClient.GetInfo();

            Text = pEncyclopediaType.Title;
            h_RefreshParts(pEncyclopediaType.PartList);
        }
Example #2
0
        /// <summary>
        /// Для обращения к сервису
        /// </summary>
        /// <returns></returns>
        private EncyclopediaServiceClient GetClient()
        {
            string sUrlService = "http://127.0.0.1:8000/Service1";
            BasicHttpContextBinding pBinding = new BasicHttpContextBinding();

            //Увеличение количества возможных байтов для отправки
            ServicePointManager.CheckCertificateRevocationList = false;
            pBinding.MaxReceivedMessageSize = int.MaxValue;
            pBinding.Name         = "BasicHttpBinding_IEncyclopediaService";
            pBinding.ReaderQuotas = XmlDictionaryReaderQuotas.Max;
            //pBinding.ReceiveTimeout = new TimeSpan(0, 3, 0);
            //pBinding.SendTimeout = new TimeSpan(0, 3, 0);

            EndpointAddress           pEndpointAddress = new EndpointAddress(sUrlService);
            EncyclopediaServiceClient pClient          = new EncyclopediaServiceClient(pBinding, pEndpointAddress);

            return(pClient);
        }