コード例 #1
0
ファイル: HostService.cs プロジェクト: htw-bui/OrkHub
        private void StartDataHost(string baseAdress)
        {
            m_DataHost = new DomainModelHost(m_DomainModelInstanceProvider, typeof (DomainModelDataService), new[]
                                                                                                       {
                                                                                                         new Uri(baseAdress + "OpenResKitHub")
                                                                                                       });

              var binding = new WebHttpBinding();
              binding.MaxReceivedMessageSize = int.MaxValue;
              binding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
              binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
              m_DataHost.AddServiceEndpoint(typeof (IRequestHandler), binding, "")
                .Behaviors.Add(new EnableCrossOriginResourceSharingBehavior());
              m_DataHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
              m_DataHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = m_CustomUserNameValidator;
              m_DataHost.Open();
        }
コード例 #2
0
 public DataServiceHost CreateServiceHost(Uri baseUri)
 {
     var host = new DataServiceHost(typeof (ODataService), new[] {baseUri });
     host.AddServiceEndpoint(typeof (IRequestHandler), new WebHttpBinding(), "");
     return host;
 }