コード例 #1
0
        /*public ProtokollerInstance()
        {
            ProtokollerConfiguration.Load(false);
            this.akConfig = ProtokollerConfiguration.ActualConfigInstance;            
        }*/

        public void Start(bool StartedAsService)
        {

            //Remoting Server für Benachrichtigung an Client das neue Daten da sind
            /*remotingServer = new RemotingServer();
            remotingServer.Start();*/

            if (akConfig.UseWebserver)
            {
                AspxVirtualRoot webServer = new AspxVirtualRoot(akConfig.WebserverPort);
                webServer.Configure("/", System.IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "web"));
            }

            if (akConfig.UseWCFService)
            {
                var serverName = "ProtocolService";
                var addressWeb = new Uri("http://localhost:" + akConfig.WCFServicePort + "/");

                wcfWebService = new WebServiceHost(this /*.GetType()*/, new Uri[] { addressWeb });

                wcfWebService.AddServiceEndpoint(typeof(IProtocolService), new BasicHttpBinding(), serverName);
                wcfWebService.AddServiceEndpoint(typeof(IPolicyRetriever), new WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior());

                wcfWebService.Open();
            }

            context = SynchronizationContext.Current;

            Logging.LogText("Protokoller gestartet", Logging.LogLevel.Information);
            EstablishConnections();
            OpenStoragesAndCreateTriggers(true, StartedAsService);

            synTimer = new Timer(synchronizePLCTimes, null, 0, 60000);            
        }