本文整理汇总了C#中ServiceHostBase.CreateUri方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceHostBase.CreateUri方法的具体用法?C# ServiceHostBase.CreateUri怎么用?C# ServiceHostBase.CreateUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceHostBase
的用法示例。
在下文中一共展示了ServiceHostBase.CreateUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: foreach
void IServiceBehavior.ApplyDispatchBehavior (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
ServiceMetadataExtension sme = ServiceMetadataExtension.EnsureServiceMetadataExtension (serviceHostBase);
foreach (var dispatcherBase in serviceHostBase.ChannelDispatchers) {
var dispatcher = dispatcherBase as ChannelDispatcher;
if (dispatcher == null) // non-ChannelDispatcher ChannelDispatcherBase instance.
continue;
if (IncludeExceptionDetailInFaults) // may be set also in ServiceBehaviorAttribute
dispatcher.IncludeExceptionDetailInFaults = true;
}
if (HttpHelpPageEnabled) {
Uri uri = serviceHostBase.CreateUri ("http", HttpHelpPageUrl);
if (uri != null)
sme.EnsureChannelDispatcher (false, "http", uri, HttpHelpPageBinding);
}
if (HttpsHelpPageEnabled) {
Uri uri = serviceHostBase.CreateUri ("https", HttpsHelpPageUrl);
if (uri != null)
sme.EnsureChannelDispatcher (false, "https", uri, HttpsHelpPageBinding);
}
}
示例2: foreach
void IServiceBehavior.ApplyDispatchBehavior (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
ServiceMetadataExtension sme = ServiceMetadataExtension.EnsureServiceMetadataExtension (serviceHostBase);
foreach (ChannelDispatcher dispatcher in serviceHostBase.ChannelDispatchers)
if (IncludeExceptionDetailInFaults) // may be set also in ServiceBehaviorAttribute
dispatcher.IncludeExceptionDetailInFaults = true;
if (HttpHelpPageEnabled) {
Uri uri = serviceHostBase.CreateUri ("http", HttpHelpPageUrl);
if (uri != null)
// FIXME: wrong. It should add help page
sme.EnsureChannelDispatcher (false, "http", uri, HttpHelpPageBinding);
}
if (HttpsHelpPageEnabled) {
Uri uri = serviceHostBase.CreateUri ("https", HttpsHelpPageUrl);
if (uri != null)
// FIXME: wrong. It should add help page
sme.EnsureChannelDispatcher (false, "https", uri, HttpsHelpPageBinding);
}
}
示例3: foreach
void IServiceBehavior.ApplyDispatchBehavior (
ServiceDescription description,
ServiceHostBase serviceHostBase) {
ServiceMetadataExtension sme = ServiceMetadataExtension.EnsureServiceMetadataExtension (serviceHostBase);
//Find ChannelDispatcher for Mex, and add a MexInstanceContextProvider
//to it
foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) {
ChannelDispatcher cd = cdb as ChannelDispatcher;
if (cd == null)
continue;
foreach (EndpointDispatcher ed in cd.Endpoints) {
if (ed.ContractName == MexContractName)
ed.DispatchRuntime.InstanceContextProvider = new MexInstanceContextProvider (serviceHostBase);
}
}
if (HttpGetEnabled) {
Uri uri = serviceHostBase.CreateUri ("http", HttpGetUrl);
if (uri != null)
sme.EnsureChannelDispatcher (true, "http", uri, HttpGetBinding);
}
if (HttpsGetEnabled) {
Uri uri = serviceHostBase.CreateUri ("https", HttpsGetUrl);
if (uri != null)
sme.EnsureChannelDispatcher (true, "https", uri, HttpsGetBinding);
}
}