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 7701699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:03:21+00:00 2026-05-31T23:03:21+00:00

I just need to secure my WF services. Can’t find any resources on this.

  • 0

I just need to secure my WF services. Can’t find any resources on this. How to do it?

Already tried:

class Program
{
    static void Main(string[] args)
    {
        using (WorkflowServiceHost host = new WorkflowServiceHost(new Workflow1(), new Uri("http://localhost/Test")))
        {
            host.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = System.ServiceModel.Security.UserNamePasswordValidationMode.Custom;
            host.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new Test();

            host.Open();
            Console.Write("ready");
            Console.ReadLine();
        }
    }
}
public class Test : UserNamePasswordValidator
{
    public Test()
    {
        Console.Write("hit");
    }

    public override void Validate(string userName, string password)
    {
        Console.Write("never hit");
    }
}

And a config

<bindings>
  <wsHttpBinding>
    <binding>
      <security mode="Message">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
      <!--<serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="myAssembly.Test, myAssembly" />
      </serviceCredentials>-->
    </behavior>
  </serviceBehaviors>
  • Can’t create a fixed name endpoint because they are dynamically created

UPDATE – I tried the configuration bellow and worked, but I want a more granular way to set what binding each service use

<protocolMapping>
  <add scheme="http" binding="wsHttpBinding"/>
</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-31T23:03:22+00:00Added an answer on May 31, 2026 at 11:03 pm

    A little hackish, but works. Overrided WorkflowServiceHost in order to grab unknown contract names and added service endpoints for each one.

        const string DEFAULT_WORKFLOW_SERVICE_BINDING_NAME = "WorkflowDefaultBinding";
    
        static void Main(string[] args)
        {            
            MyWorkflowServiceHost host = new MyWorkflowServiceHost(new CountingWorkflow2(), new Uri(hostBaseAddress));
            foreach (var contractName in host.ImplementedContractsNames)
            {
                // now I'm able to choose which binding to use depending on a condition
                var binding = new WSHttpBinding(DEFAULT_WORKFLOW_SERVICE_BINDING_NAME);
    
                host.AddServiceEndpoint(contractName, binding, string.Empty);
            }
        }
    

    And MyWorkflowServiceHost

        public class MyWorkflowServiceHost : WorkflowServiceHost
        {
            public MyWorkflowServiceHost(Activity activity, params Uri[] baseAddresses)
                : base(activity, baseAddresses)
            {
    
            }
    
            private IDictionary<string, System.ServiceModel.Description.ContractDescription> _implementedContracts;
            public IEnumerable<string> ImplementedContractsNames
            {
                get
                {
                    foreach (var contract in _implementedContracts)
                        yield return contract.Key;
                }
            }
    
            protected override System.ServiceModel.Description.ServiceDescription CreateDescription(out System.Collections.Generic.IDictionary<string, System.ServiceModel.Description.ContractDescription> implementedContracts)
            {
                System.ServiceModel.Description.ServiceDescription description = base.CreateDescription(out implementedContracts);
    
                _implementedContracts = implementedContracts;
    
                return description;
            }
        }
    

    Adding a unamed WSHttpBinding and the following section on service model should work too, but for default configuration

    <protocolMapping>
      <add scheme="http" binding="wsHttpBinding"/>
    </protocolMapping>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just need to know if WCF is platform independent like Webservices? Can the
I just need to be pointed in the right direction - I can research
I'm following this guide: http://code.google.com/intl/it-IT/apis/documents/docs/2.0/developers_guide_java.html I just need to retrieve a token and use
I just need to protect a few pages that can edit the entries in
Just need some quick clarification I have 2 Queries in my Access Database that
Just need a little bit of Javascript to warn people that press the back
Just need get some vals located in application.ini(main ini) in the Controller plugin I
I just need a help in configuring hiberclipse for my eclipse indigo version. Install
I just need some clarification on variables A normal variable has 2 parts to
I just need to rename JQgrid column dynamically as per user selection from a

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.