本文整理汇总了C#中ServiceHostBase.GetVia方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceHostBase.GetVia方法的具体用法?C# ServiceHostBase.GetVia怎么用?C# ServiceHostBase.GetVia使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceHostBase
的用法示例。
在下文中一共展示了ServiceHostBase.GetVia方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetExtensionProperties
private void SetExtensionProperties(ServiceMetadataExtension mex, ServiceHostBase host)
{
mex.HttpHelpPageEnabled = this.httpHelpPageEnabled;
mex.HttpHelpPageUrl = host.GetVia(Uri.UriSchemeHttp, (this.httpHelpPageUrl == null) ? new Uri(string.Empty, UriKind.Relative) : this.httpHelpPageUrl);
mex.HttpHelpPageBinding = this.HttpHelpPageBinding;
mex.HttpsHelpPageEnabled = this.httpsHelpPageEnabled;
mex.HttpsHelpPageUrl = host.GetVia(Uri.UriSchemeHttps, (this.httpsHelpPageUrl == null) ? new Uri(string.Empty, UriKind.Relative) : this.httpsHelpPageUrl);
mex.HttpsHelpPageBinding = this.HttpsHelpPageBinding;
}
示例2: EnsureHelpPageDispatcher
private bool EnsureHelpPageDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, string scheme)
{
Uri via = host.GetVia(scheme, (url == null) ? new Uri(string.Empty, UriKind.Relative) : url);
if (via == null)
{
return false;
}
((ServiceMetadataExtension.HttpGetImpl) mex.EnsureGetDispatcher(via, 1).Endpoints[0].DispatchRuntime.SingletonInstanceContext.UserObject).HelpPageEnabled = true;
return true;
}
示例3: EnsureListenUri
static Uri EnsureListenUri(ServiceHostBase serviceHost, ServiceEndpoint endpoint)
{
Uri listenUri = endpoint.ListenUri;
if (listenUri == null)
{
listenUri = serviceHost.GetVia(endpoint.Binding.Scheme, ServiceHost.EmptyUri);
}
if (listenUri == null)
{
AspNetEnvironment.Current.ProcessNotMatchedEndpointAddress(listenUri, endpoint.Binding.Name);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxEndpointNoMatchingScheme, endpoint.Binding.Scheme, endpoint.Binding.Name, serviceHost.GetBaseAddressSchemes())));
}
return listenUri;
}
示例4: EnsureHelpPageDispatcher
bool EnsureHelpPageDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, string scheme)
{
Uri address = host.GetVia(scheme, url == null ? new Uri(string.Empty, UriKind.Relative) : url);
if (address == null)
{
return false;
}
ChannelDispatcher channelDispatcher = mex.EnsureGetDispatcher(address, true /* isServiceDebugBehavior */);
((ServiceMetadataExtension.HttpGetImpl)channelDispatcher.Endpoints[0].DispatchRuntime.SingletonInstanceContext.UserObject).HelpPageEnabled = true;
return true;
}
示例5: SetExtensionProperties
void SetExtensionProperties(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
{
mex.ExternalMetadataLocation = this.ExternalMetadataLocation;
mex.Initializer = new MetadataExtensionInitializer(this, description, host);
mex.HttpGetEnabled = this.httpGetEnabled;
mex.HttpsGetEnabled = this.httpsGetEnabled;
mex.HttpGetUrl = host.GetVia(Uri.UriSchemeHttp, this.httpGetUrl == null ? new Uri(string.Empty, UriKind.Relative) : this.httpGetUrl);
mex.HttpsGetUrl = host.GetVia(Uri.UriSchemeHttps, this.httpsGetUrl == null ? new Uri(string.Empty, UriKind.Relative) : this.httpsGetUrl);
mex.HttpGetBinding = this.httpGetBinding;
mex.HttpsGetBinding = this.httpsGetBinding;
UseRequestHeadersForMetadataAddressBehavior dynamicUpdateBehavior = description.Behaviors.Find<UseRequestHeadersForMetadataAddressBehavior>();
if (dynamicUpdateBehavior != null)
{
mex.UpdateAddressDynamically = true;
mex.UpdatePortsByScheme = new Dictionary<string, int>(dynamicUpdateBehavior.DefaultPortsByScheme);
}
foreach (ChannelDispatcherBase dispatcherBase in host.ChannelDispatchers)
{
ChannelDispatcher dispatcher = dispatcherBase as ChannelDispatcher;
if (dispatcher != null && IsMetadataTransferDispatcher(description, dispatcher))
{
mex.MexEnabled = true;
mex.MexUrl = dispatcher.Listener.Uri;
if (dynamicUpdateBehavior != null)
{
foreach (EndpointDispatcher endpointDispatcher in dispatcher.Endpoints)
{
if (!endpointDispatcher.AddressFilterSetExplicit)
{
endpointDispatcher.AddressFilter = new MatchAllMessageFilter();
}
}
}
break;
}
}
}
示例6: EnsureGetDispatcher
private static void EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, string scheme)
{
Uri via = host.GetVia(scheme, (url == null) ? new Uri(string.Empty, UriKind.Relative) : url);
if (via == null)
{
if (scheme == Uri.UriSchemeHttp)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxServiceMetadataBehaviorNoHttpBaseAddress")));
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxServiceMetadataBehaviorNoHttpsBaseAddress")));
}
((ServiceMetadataExtension.HttpGetImpl) mex.EnsureGetDispatcher(via, 0).Endpoints[0].DispatchRuntime.SingletonInstanceContext.UserObject).GetWsdlEnabled = true;
}