开发者

WCF Transport Security

开发者 https://www.devze.com 2023-03-03 00:11 出处:网络
i have WSHttpBinding and ServiceHost in my code. how 开发者_高级运维can i set httpsGetEnabled and

i have WSHttpBinding and ServiceHost in my code. how 开发者_高级运维can i set httpsGetEnabled and mexHttpsBinding from code behind?


ServiceHost host = new ServiceHost(typeof(MyService));
ServiceMetadataBehavior metadataBehavior;
metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();

if(metadataBehavior == null)
{
    Debug.Assert(BaseAddresses.Any(baseAddress=>baseAddress.Uri.Scheme == "http"));
    metadataBehavior = new ServiceMetadataBehavior();
    metadataBehavior.HttpGetEnabled = true;
    host.Description.Behaviors.Add(metadataBehavior);
}

host.Open();
0

精彩评论

暂无评论...
验证码 换一张
取 消