public IDXVCSService CreateService(string serviceUrl)
        {
            if (isServiceRegistered)
            {
                try {
                    int version = service.GetServiceVersion();
                    return(service);
                }
                catch {
                }
            }
            EndpointAddress myEndpointAddress      = new EndpointAddress(new Uri(serviceUrl), new SpnEndpointIdentity(String.Empty));
            ServiceEndpoint point                  = GZipMessageEncodingBindingElement.CreateEndpoint(myEndpointAddress);
            ChannelFactory <IDXVCSService> factory = new Factory(point);

            factory.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;
            IDXVCSService   newService = factory.CreateChannel();
            IContextChannel newChannel = (IContextChannel)newService;

            newChannel.OperationTimeout = TimeSpan.MaxValue;
            newChannel.Open();
            service             = newService;
            isServiceRegistered = true;
            service             = new ServiceWrapper(newService);
            return(service);
        }
Exemple #2
0
        T Create()
        {
            T newService = factory.CreateChannel();
            IContextChannel newChannel = (IContextChannel)newService;

            newChannel.OperationTimeout = new TimeSpan(0, 10, 0);
            newChannel.Open();
            return(newService);
        }
Exemple #3
0
        public IDXVCSService GetService(string serviceUrl)
        {
            EndpointAddress myEndpointAddress      = new EndpointAddress(new Uri(serviceUrl), new SpnEndpointIdentity(String.Empty));
            ServiceEndpoint point                  = GZipMessageEncodingBindingElement.CreateEndpoint(myEndpointAddress, typeof(IDXVCSService));
            ChannelFactory <IDXVCSService> factory = new Factory(point);

            factory.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;
            IDXVCSService   newService = factory.CreateChannel();
            IContextChannel newChannel = (IContextChannel)newService;

            newChannel.OperationTimeout = TimeSpan.FromSeconds(10);
            newChannel.Open();
            return(new ServiceWrapper(newService));
        }
Exemple #4
0
 /// <summary>
 /// Opens the channel
 /// </summary>
 private void Open()
 {
     try
     {
         System.Diagnostics.Trace.WriteLine("Opening channel '" + typeof(T).Name + "'");
         IContextChannel ch = (IContextChannel)Factory.CreateChannel();
         ch.Open();
         ch.Faulted += new EventHandler(Channel_Faulted);
         Channel     = ch;
     }
     catch (Exception ex)
     {
         System.Reflection.MethodBase mb = System.Reflection.MethodBase.GetCurrentMethod();
         System.Diagnostics.Trace.WriteLine(ex.Message, string.Format("{0}.{1}.{2}", mb.DeclaringType.Namespace, mb.DeclaringType.Name, mb.Name));
         throw;
     }
 }