Пример #1
0
        private void Run()
        {
            try
            {
                using (ServiceHost host = new ServiceHost(typeof(CT_SyncGoogleCalendar.CT_SyncGoogleCalendar), baseAddress))
                {

                    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                    smb.HttpGetEnabled = true;
                    smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                    host.Description.Behaviors.Add(smb);
                    host.Open();

                    CT_SyncGoogleCalendar.ICT_SyncGoogleCalendar client = new CT_SyncGoogleCalendar.CT_SyncGoogleCalendar();
                    client.SyncGoogleCalendars();
                    host.Close();
                }
            }
            catch (Exception ex)
            {
                File.WriteAllLines("D://testLog.txt", new string[] { ex.Message });
            }
        }
Пример #2
0
        private void Run()
        {
            try
            {
                using (ServiceHost host = new ServiceHost(typeof(CT_SyncGoogleCalendar.CT_SyncGoogleCalendar), baseAddress))
                {

                    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                    smb.HttpGetEnabled = true;
                    smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                    host.Description.Behaviors.Add(smb);
                    host.Open();
                    //calling Google service
                    CT_SyncGoogleCalendar.ICT_SyncGoogleCalendar client = new CT_SyncGoogleCalendar.CT_SyncGoogleCalendar();
                    //   client.SyncGoogleCalendars(825);
                    client.SyncGoogleCalendars(Convert.ToInt32(ConfigurationManager.AppSettings["Orgnization_Id"]));
                    host.Close();
                }
            }
            catch (Exception ex)
            {
                File.WriteAllLines("D://testLog.txt", new string[] { ex.Message });
            }
        }