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; }
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; }
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; } } }
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); }
static bool EnsureGetDispatcher(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) { ChannelDispatcher channelDispatcher = mex.EnsureGetDispatcher(address, false /* isServiceDebugBehavior */); ((ServiceMetadataExtension.HttpGetImpl)channelDispatcher.Endpoints[0].DispatchRuntime.SingletonInstanceContext.UserObject).GetWsdlEnabled = true; return(true); } return(false); }
private bool EnsureHealthDispatcher(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 = EnsureGetDispatcher(host, mex, address); ((ServiceMetadataExtension.HttpGetImpl)channelDispatcher.Endpoints[0].DispatchRuntime.SingletonInstanceContext.UserObject).HealthBehavior = this; return(true); }
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; }
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; }
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; }
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; } } }
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; }
private void CreateWorkflowManagementEndpoint(WorkflowServiceHost workflowServiceHost) { Binding namedPipeControlEndpointBinding; IChannelListener listener; if (workflowServiceHost.InternalBaseAddresses.Contains(Uri.UriSchemeNetPipe)) { namedPipeControlEndpointBinding = NamedPipeControlEndpointBinding; } else if (workflowServiceHost.InternalBaseAddresses.Contains(Uri.UriSchemeHttp)) { namedPipeControlEndpointBinding = HttpControlEndpointBinding; } else { return; } Uri listenUriBaseAddress = ServiceHostBase.GetVia(namedPipeControlEndpointBinding.Scheme, new Uri("System.ServiceModel.Activities_IWorkflowInstanceManagement", UriKind.Relative), workflowServiceHost.InternalBaseAddresses); XmlQualifiedName contractName = new XmlQualifiedName("IWorkflowInstanceManagement", "http://schemas.datacontract.org/2008/10/WorkflowServices"); EndpointAddress address = new EndpointAddress(listenUriBaseAddress.AbsoluteUri); EndpointDispatcher item = new EndpointDispatcher(address, "IWorkflowInstanceManagement", "http://schemas.datacontract.org/2008/10/WorkflowServices", true) { ContractFilter = new ActionMessageFilter(new string[] { NamingHelper.GetMessageAction(contractName, "Abandon", null, false), NamingHelper.GetMessageAction(contractName, "Cancel", null, false), NamingHelper.GetMessageAction(contractName, "Run", null, false), NamingHelper.GetMessageAction(contractName, "Suspend", null, false), NamingHelper.GetMessageAction(contractName, "Terminate", null, false), NamingHelper.GetMessageAction(contractName, "TransactedCancel", null, false), NamingHelper.GetMessageAction(contractName, "TransactedRun", null, false), NamingHelper.GetMessageAction(contractName, "TransactedSuspend", null, false), NamingHelper.GetMessageAction(contractName, "TransactedTerminate", null, false), NamingHelper.GetMessageAction(contractName, "TransactedUnsuspend", null, false), NamingHelper.GetMessageAction(contractName, "Unsuspend", null, false) }) }; BindingParameterCollection parameters = new BindingParameterCollection(); VirtualPathExtension extension = workflowServiceHost.Extensions.Find <VirtualPathExtension>(); if (extension != null) { parameters.Add(extension); } ChannelProtectionRequirements requirements = new ChannelProtectionRequirements(); requirements.Add(ChannelProtectionRequirements.CreateFromContract(WorkflowControlEndpoint.WorkflowControlServiceContract, ProtectionLevel.EncryptAndSign, ProtectionLevel.EncryptAndSign, false)); parameters.Add(requirements); if (namedPipeControlEndpointBinding.CanBuildChannelListener <IDuplexSessionChannel>(new object[] { listenUriBaseAddress, parameters })) { listener = namedPipeControlEndpointBinding.BuildChannelListener <IDuplexSessionChannel>(listenUriBaseAddress, parameters); } else if (namedPipeControlEndpointBinding.CanBuildChannelListener <IReplySessionChannel>(new object[] { listenUriBaseAddress, parameters })) { listener = namedPipeControlEndpointBinding.BuildChannelListener <IReplySessionChannel>(listenUriBaseAddress, parameters); } else { listener = namedPipeControlEndpointBinding.BuildChannelListener <IReplyChannel>(listenUriBaseAddress, parameters); } foreach (OperationDescription description in WorkflowControlEndpoint.WorkflowControlServiceContract.Operations) { bool flag; bool flag2; DataContractSerializerOperationBehavior behavior = new DataContractSerializerOperationBehavior(description); DispatchOperation operation = new DispatchOperation(item.DispatchRuntime, description.Name, NamingHelper.GetMessageAction(description, false), NamingHelper.GetMessageAction(description, true)) { Formatter = (IDispatchMessageFormatter)behavior.GetFormatter(description, out flag, out flag2, false), Invoker = new ControlOperationInvoker(description, new WorkflowControlEndpoint(namedPipeControlEndpointBinding, address), null, workflowServiceHost) }; item.DispatchRuntime.Operations.Add(operation); OperationBehaviorAttribute attribute = description.Behaviors.Find <OperationBehaviorAttribute>(); ((IOperationBehavior)attribute).ApplyDispatchBehavior(description, operation); if (attribute.TransactionScopeRequired) { ((ITransactionChannelManager)listener).Dictionary.Add(new DirectionalAction(MessageDirection.Input, NamingHelper.GetMessageAction(description, false)), TransactionFlowOption.Allowed); } } DispatchRuntime dispatchRuntime = item.DispatchRuntime; dispatchRuntime.ConcurrencyMode = ConcurrencyMode.Multiple; dispatchRuntime.InstanceContextProvider = new DurableInstanceContextProvider(workflowServiceHost); dispatchRuntime.InstanceProvider = new DurableInstanceProvider(workflowServiceHost); dispatchRuntime.ServiceAuthorizationManager = new WindowsAuthorizationManager(this.WindowsGroup); ServiceDebugBehavior behavior2 = workflowServiceHost.Description.Behaviors.Find <ServiceDebugBehavior>(); ServiceBehaviorAttribute attribute2 = workflowServiceHost.Description.Behaviors.Find <ServiceBehaviorAttribute>(); bool flag3 = false; if (behavior2 != null) { flag3 |= behavior2.IncludeExceptionDetailInFaults; } if (attribute2 != null) { flag3 |= attribute2.IncludeExceptionDetailInFaults; } ChannelDispatcher dispatcher4 = new ChannelDispatcher(listener, namedPipeControlEndpointBinding.Name, namedPipeControlEndpointBinding) { MessageVersion = namedPipeControlEndpointBinding.MessageVersion }; dispatcher4.Endpoints.Add(item); dispatcher4.ServiceThrottle = workflowServiceHost.ServiceThrottle; ChannelDispatcher dispatcher2 = dispatcher4; workflowServiceHost.ChannelDispatchers.Add(dispatcher2); }