none
Question on how to make WCF work reliable? RRS feed

  • Question

  • Hi,

    I have some questions on how to make my WCF service reliable.

    Setup
    My services contains 3 WCF services, 2 is a regular Webservice over HTTP and another is a TCP service using Protobuf. The TCP service is customized in many ways to make it working as good as possible with the Winform clikent.

    This is then hosted in a Windows Service.

    The WCF project contains a CustomHostServiceFactory where ApplyConfiguration is used to load all all cache data(all services uses the same BLL where the cache is).

    protected override void ApplyConfiguration()
            {
                base.ApplyConfiguration();
    
                Startup();
            }

    The Windows Services contains the following on startup

    private ServiceHost StartService(Type serviceType)
            {
                ServiceHost serviceHost = null;
    
                // Create a ServiceHost for the CalculatorService type and 
                // provide the base address.
                Console.WriteLine("Creating service " + serviceType.FullName);
                serviceHost = new ServiceHost(serviceType);
    
                serviceHost.Opened += serviceHost_Opened;
                serviceHost.Closed += serviceHost_Closed;
    
                // Open the ServiceHostBase to create listeners and start 
                // listening for messages.
                Console.WriteLine("Starting service...");
                serviceHost.Open();
                Console.WriteLine("Service started successfully");
                Console.WriteLine("...");
                return serviceHost;
    
            }

    This code used used both from the Main(ServiceBase) and from the OnStart(override) in Windows service.

    Problem
    Now I have to make sure that this is the correct why to set this up? Can a service receive a call during startup but before the init of the caches have been runned? 


    Monday, June 10, 2013 11:34 AM

Answers