Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:21:58+00:00 2026-05-30T21:21:58+00:00

Is it possible to define a standard ServiceHostFactory foreach ‘workflow’ service (xamlx) Our customers

  • 0

Is it possible to define a standard ServiceHostFactory foreach ‘workflow’ service (xamlx)

Our customers can make there own workflows (xamlx) using a custom workflow designer. We force the workflowservices into having a WS2007FederationHttpBinding with TransportSecurity. We turn of ServiceMetadataBehavior of for the WorkflowService and finally add a DataContractResolver that does some type resolving.

The ServiceHostFactory

    public class MyServiceHostFactory : WorkflowServiceHostFactory
{
    protected override WorkflowServiceHost CreateWorkflowServiceHost(
        System.ServiceModel.Activities.WorkflowService service,
        Uri[] baseAddresses)
    {
        WorkflowServiceHost host = base.CreateWorkflowServiceHost(service, baseAddresses);

        foreach (Uri adres in baseAddresses)
        {
            if (adres.Scheme == "https")
            {
                WorkflowCreationEndpoint endpoint = new WorkflowCreationEndpoint(
                    new WS2007FederationHttpBinding("IWorkflowService_ws2007FederationHttpBinding"),
                    new EndpointAddress(adres));

                host.AddServiceEndpoint(endpoint);

                PageflowDataContractResolver.AttachDataContractResolver(endpoint);
            }
        }

        var metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
        metadataBehavior.HttpGetEnabled = false;

        host.WorkflowExtensions.Add(new WorkflowInstanceTracking());

        return host;
    }

    public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
    {
        return base.CreateServiceHost(constructorString, baseAddresses);
    }

    protected override WorkflowServiceHost CreateWorkflowServiceHost(System.Activities.Activity activity, Uri[] baseAddresses)
    {            
        return base.CreateWorkflowServiceHost(activity, baseAddresses);
    }
}

The workflows exist in a database as Ron Jacob wrote in this blog. ‘Consultants’ and/or end users can create workflows using a custom tool, but each time they do they must not forget to add a serviceActivation element in the web.config which is not wanted.

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="false">
      <baseAddressPrefixFilters>
        <add prefix="http://localhost" />
      </baseAddressPrefixFilters>
      <serviceActivations>
        <add relativeAddress="~/Workflows/test.xamlx" service="Workflows/test.xamlx" factory="Foo.Bar.MyServiceHostFactory" />
      </serviceActivations>
    </serviceHostingEnvironment>
    <protocolMapping>
        <add scheme="https" binding="ws2007FederationHttpBinding" />
    </protocolMapping>
..
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:22:00+00:00Added an answer on May 30, 2026 at 9:22 pm

    I think it would be correct to rephrase your question as:

    Is there a way to change the default WorkflowServiceHostFactory for a web application so that config-less xamlx activation will use my WSHF instead.

    If I have understood your question correctly then I don’t think there is a way to do this. I had a quick look to see if there is a place you can override it but couldn’t see any. Another way to achieve this is to modify the web.config as necessary when a user uploads a new workflow. Editing the web.config in-flight should result in any currently running pulses of execution being serviced by the existing AppDomain while a new AppDomain is created to service new requests to the web application. Thus no loss of workflow processing should occur. This of course would require some testing and verification.

    UPDATE
    It looks like this might be possible. If you add the following to your web.config (which is from the default config for workflow activation).

    <?xml version="1.0"?>
    <configuration>
      <configSections>
        <sectionGroup name="system.xaml.hosting"
                      type="System.Xaml.Hosting.Configuration.XamlHostingSectionGroup,     System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="httpHandlers"
                   type="System.Xaml.Hosting.Configuration.XamlHostingSection, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            </sectionGroup>
      </configSections>
    
      <system.xaml.hosting>
        <httpHandlers>
          <add xamlRootElementType="System.ServiceModel.Activities.WorkflowService, System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
               httpHandlerType="System.ServiceModel.Activities.Activation.ServiceModelActivitiesActivationHandlerAsync, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          <add xamlRootElementType="System.Activities.Activity, System.Activities,     Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
               httpHandlerType="System.ServiceModel.Activities.Activation.ServiceModelActivitiesActivationHandlerAsync, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </httpHandlers>
      </system.xaml.hosting>
    
    </configuration>
    

    The class ServiceModelActivitiesActivationHandlerAsync that this default config uses is implemented as follows:

    internal class ServiceModelActivitiesActivationHandlerAsync : ServiceHttpHandlerFactory, IServiceModelActivationHandler
    {
        // Methods
        public ServiceHostFactoryBase GetFactory()
        {
            return new WorkflowServiceHostFactory();
        }
    }
    

    Then instead of using the ServiceModelActivitiesActivationHandlerAsync, provide an implementation yourself which instantiates your own WorkflowServiceHostFactory in the GetFactory method. Update the web.config above to point to your new httpHandlerType and you should be done.

    I haven’t tested this at all. It’s possible IIS will not like the web.config overriding the system.xaml.hosting section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is it possible to define enumalpha? Is there any equivalent of Java
In Silverlight, I have a standard IValueConverter where I want to define the possible
Does the standard define precisely what I can do with an object once it
Possible Duplicate: Define a method that has many (or infinite) arguments I have the
Is it possible to define an instance method in ruby from a string (the
Is it possible to define a regex which will match every character except a
Is it possible to define an array of text fields (or any data type)
Is it possible to define operators for enums? For example I have enum Month
Is it possible to define two sections in the web.xml in order to catch
Is it possible to define private variables in a PHP script so these variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.