コード例 #1
0
        static App()
        {
            DispatcherHelper.Initialize();

            var serviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(FluentAutomation.RemoteCommands.ServiceEndpoint), new Uri("http://localhost:10001/"));

            serviceHost.Open();
        }
コード例 #2
0
ファイル: TeenService.cs プロジェクト: Delnar/TeenCheckin
        /// <summary>
        /// Start the HTTP Service
        /// </summary>
        /// <param name="NetTCPServiceHost"></param>
        public void StartHTTPService()
        {
            if (_HTTPserviceHost != null)
            {
                _HTTPserviceHost.Close();
            }
            _HTTPserviceHost = null;

            _HTTPserviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(wcfTeenService.wcf.TeenService));
            _HTTPserviceHost.Open();
        }
コード例 #3
0
ファイル: TeenService.cs プロジェクト: Delnar/TeenCheckin
        /// <summary>
        /// Start the HTTP Service
        /// </summary>
        /// <param name="NetTCPServiceHost"></param>
        public void StartHTTPService()
        {
            if (_HTTPserviceHost != null)
            {
                _HTTPserviceHost.Close();
            }
            _HTTPserviceHost = null;

            _HTTPserviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(wcfTeenService.wcf.TeenService));
            _HTTPserviceHost.Open();
        }
コード例 #4
0
 public void OpenHost()
 {
     try
     {
         //WebHttpBinding
         WebHttpBinding webBinding = new WebHttpBinding();
         webBinding.MaxBufferPoolSize = int.MaxValue;
         webBinding.MaxReceivedMessageSize = int.MaxValue;
         webBinding.Security.Mode = WebHttpSecurityMode.None;
         webBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
         //NetTcpBinding
         NetTcpBinding tcpBinding = new NetTcpBinding();
         tcpBinding.MaxBufferPoolSize = int.MaxValue;
         tcpBinding.MaxReceivedMessageSize = int.MaxValue;
         tcpBinding.Security.Mode = SecurityMode.None;
         tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
         //ServiceBehavior
         ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
         smb.HttpsGetEnabled = false;
         smb.HttpGetEnabled = true;
         _host.Description.Behaviors.Add(smb);
         ServiceDebugBehavior sdb = _host.Description.Behaviors.Find<ServiceDebugBehavior>();
         sdb.HttpHelpPageEnabled = Globals.IsDebugMode;
         sdb.HttpsHelpPageEnabled = Globals.IsDebugMode;
         sdb.IncludeExceptionDetailInFaults = Globals.IsDebugMode;
         UseRequestHeadersForMetadataAddressBehavior urhfmab = new UseRequestHeadersForMetadataAddressBehavior();
         _host.Description.Behaviors.Add(urhfmab);
         //MEX endpoint
         _host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
         if (Globals.UseClientTcpHost && Globals.UseClientHttpHost)
         {
             _host.AddServiceEndpoint(typeof(IService), tcpBinding, _tcpBaseAddress);
             _host.AddServiceEndpoint(typeof(IService), webBinding, _httpBaseAddress);
             _host.Description.Endpoints[2].Contract = CopyContract(_host.Description.Endpoints[1].Contract);
         } 
         else if (Globals.UseClientTcpHost)
         {
             _host.AddServiceEndpoint(typeof(IService), tcpBinding, _tcpBaseAddress);
         }
         else if (Globals.UseClientHttpHost)
         {
             _host.AddServiceEndpoint(typeof(IService), webBinding, _httpBaseAddress);
             _host.Description.Endpoints[1].Contract = CopyContract(_host.Description.Endpoints[1].Contract);
         }
         _host.Open();
         IsOpen = true;
コード例 #5
0
        public void Start()
        {
            switch (_svc_hosts_type)
            {
            case ServiceHostType.soap:
                if (_soap_service_host != null)
                {
                    _soap_service_host.Open();
                }
                break;

            case ServiceHostType.web:
                if (_web_service_host != null)
                {
                    _web_service_host.Open();
                }
                break;
            }
        }