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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:21:07+00:00 2026-06-10T22:21:07+00:00

I have successfully created a working custom STS using the project templates for the

  • 0

I have successfully created a working custom STS using the project templates for the passive and active cases that came with the most recent WIF SDK (for .NET 4.0). Everything works as desired.

I am now trying to upgrade my web applications and services to .NET 4.5, including my custom STS. I have been able to map all of the namespaces/classes from Microsoft.IdentityModel.xxx to the new namespaces/classes built into the framework with 1 exception – WSTrustServiceHostFactory.

That class no longer seems to exist, and I cannot figure out how to replace the functionality it provided. Namely, from this link:
http://msdn.microsoft.com/en-us/library/microsoft.identitymodel.protocols.wstrust.wstrustservicehostfactory

<%@ServiceHostLanguage="C#"Debug="true"Service="XXX.XXX.MyActiveSTSConfiguration"Factory="Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceHostFactory"%>

My passive STS is currently working after upgrading to 4.5. I need to find an appropriate/recommended method of instantiating an active SecurityTokenService using the 4.5 framework (ideally, using web.config for most configuration as in the SDK project templates). Any suggestions are appreciated.

  • 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-06-10T22:21:09+00:00Added an answer on June 10, 2026 at 10:21 pm

    This turned out to be pretty simple once I figured a few things out.

    Service host markup:

    <%@ ServiceHost Language="C#" Debug="true" Service="XXX.XXX.MyActiveSTSConfiguration" Factory="XXX.XXX.CustomWSTrustServiceHostFactory" %>
    

    Here’s my custom factory class implementation. The key is that since you can no longer use WSTrustServiceFactory to create a WSTrustServiceHost for you, you have to explicitly create one yourself in the CreateServiceHost method overrides.

    public class CustomWSTrustServiceHostFactory 
        : ServiceHostFactory {
    
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomWSTrustServiceHostFactory"/> class.
        /// </summary>
        public CustomWSTrustServiceHostFactory() 
            : base() { }
    
        /// <summary>
        /// Creates and configures a <see cref="WSTrustServiceHost"/> with a specific base address.
        /// </summary>
        /// <param name="serviceType">Specifies the type of service to host (ignored).</param>
        /// <param name="baseAddresses">The <see cref="T:Uri"/> array that contains the base addresses for the service.</param>
        /// <returns>A <see cref="WSTrustServiceHost"/> with a specific base address.</returns>
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {
            var config = new PortalActiveSTSConfiguration();
            var host = new WSTrustServiceHost(config, baseAddresses);
            //var host = base.CreateServiceHost(serviceType, baseAddresses);
            var serviceBehavior = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
            serviceBehavior.AddressFilterMode = AddressFilterMode.Any;
            return host;
        }
    
        /// <summary>
        /// Creates and configures a <see cref="WSTrustServiceHost"/> with a specific base address.
        /// </summary>
        /// <param name="constructorString">The constructor string (ignored).</param>
        /// <param name="baseAddresses">The <see cref="T:Uri"/> array that contains the base addresses for the service.</param>
        /// <returns></returns>
        public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses) {
            var config = new PortalActiveSTSConfiguration();
            var host = new WSTrustServiceHost(config, baseAddresses);
            //var host = base.CreateServiceHost(constructorString, baseAddresses);
            var serviceBehavior = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
            serviceBehavior.AddressFilterMode = AddressFilterMode.Any;
            return host;
        }
    
    }
    

    Custom service configuration class implementation (basically what came with the WIF 4.0 STS template):

    public class MyActiveSTSConfiguration 
        : SecurityTokenServiceConfiguration {
    
        public MyActiveSTSConfiguration()
            : base(
                WebConfigurationManager.AppSettings[ISSUER_NAME],
                    new X509SigningCredentials(
                        CertificateUtil.GetCertificate(
                            StoreName.My, StoreLocation.LocalMachine, X509FindType.FindByThumbprint,
                            WebConfigurationManager.AppSettings[SIGNING_CERTIFICATE_THUMBPRINT], 
                            true)
                    )
            ) {
            this.SecurityTokenService = typeof(MyActiveSTS);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom SharePoint web service that was deployed to, and successfully
I have successfully created one custom dialog box. Dialog box is working good. I
I am working on an application that uses Swing. I have successfully created a
I have successfully created a feature in sharepoint that modifies the existing edit dialog
I have successfully created a custom Facebook open graph action, and have been able
I have successfully created an app that reads from a bundled .plist file and
I have created a chat application using the Jabber Smack API. I'm successfully receiving
I have created a custom labeller for CC.Net which is working almost perfectly, however
I've successfully created an app that minimizes to the tray using a NotifyIcon. When
I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created

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.