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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:30:26+00:00 2026-05-31T11:30:26+00:00

I’m trying to host multiple services using one WcfFacility and IIS, and I’m seeing

  • 0

I’m trying to host multiple services using one WcfFacility and IIS, and I’m seeing some confusing results.

Here is my configuration:

        var baseUri = new Uri(HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped));

        container.AddFacility<WcfFacility>(f => { f.CloseTimeout = TimeSpan.Zero; }).Register(
            Component.For<IAttributeService>()                  
                .ImplementedBy<AttributeService>()
                .AsWcfService(
                    new DefaultServiceModel()
                        .Hosted()                           
                        .AddEndpoints(
                            WcfEndpoint.ForContract<IAttributeService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
                            WcfEndpoint.ForContract<IAttributeService>().BoundTo(new WSHttpBinding()).At("Soap12")
                        )
                .AddBaseAddresses(new Uri(baseUri, "AttributeService.svc"))                 
                ),                      
            Component.For<ISessionService>()
                .ImplementedBy<SessionService>()
                .AsWcfService(
                    new DefaultServiceModel()
                        .Hosted()                           
                        .AddEndpoints(
                            WcfEndpoint.ForContract<ISessionService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
                            WcfEndpoint.ForContract<ISessionService>().BoundTo(new WSHttpBinding()).At("Soap12")
                        )
                .AddBaseAddresses(new Uri(baseUri, "SessionService.svc"))
                ),          
            Component.For<ISampleService>()
                .ImplementedBy<SampleService>()
                .AsWcfService(
                    new DefaultServiceModel()
                        .Hosted()
                        .AddEndpoints(
                            WcfEndpoint.ForContract<ISampleService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
                            WcfEndpoint.ForContract<ISampleService>().BoundTo(new WSHttpBinding()).At("Soap12")
                        )
                .AddBaseAddresses(new Uri(baseUri, "SampleService.svc"))
                )
        );

When I go to use the WCF Test client to check on this, it seems as though the methods available under each service are a composite of that service and all the services that I mex’ed before that. Example:
looking at a service in WCF Test Client

Am I doing this wrong? You can’t add the WcfFacility multiple times, and poking around on the internets, I can’t seem to find an example where someone is hosting multiple services in one facility.

Any ideas?

  • 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-31T11:30:28+00:00Added an answer on May 31, 2026 at 11:30 am

    I’ve figured it out. Previously, I was enabling HttpGet on MetaData using the following code:

    var metadata = new ServiceMetadataBehavior { HttpGetEnabled = true };
    container.Register(Component.For<IServiceBehavior>().Instance(metadata));
    

    Which was following the code in this github example.

    It seems as though this approach causes the WcfFacility to share MetaData for all services on any get request.

    The solution was simple. First, remove that stuff. Second, configure each service component in this manner

    Component.For<IAttributeService>()                  
    .ImplementedBy<AttributeService>()
    .AsWcfService(
        new DefaultServiceModel()
            .Hosted()
            .PublishMetadata(x => x.EnableHttpGet())
            .AddBaseAddresses(new Uri(baseUri, "AttributeService.svc"))             
            .AddEndpoints(
                WcfEndpoint.ForContract<IAttributeService>().BoundTo(new BasicHttpBinding()).At("Soap11"),
                WcfEndpoint.ForContract<IAttributeService>().BoundTo(new WSHttpBinding()).At("Soap12")
            )                               
    ),
    

    Specifically, the trick was to add this code .PublishMetadata(x => x.EnableHttpGet()) in every component.

    Now I’m seeing the expected behavior on each service.

    The expected behavior! Yay!

    Edit: Once I got it working, I went to work removing things that may or may not be required- I love convention over configuration. Here is the result, doesn’t seem to be anything else to take away. The nice thing about this is that I can refactor further into a generic registration for all services, rather than needing one registration for each. Just sharing the goods.

            Component.For<IAttributeService>()
                .ImplementedBy<AttributeService>()
                .AsWcfService(
                    new DefaultServiceModel()
                        .Hosted()
                        .PublishMetadata(x => x.EnableHttpGet())
                        .AddEndpoints(
                            WcfEndpoint.BoundTo(new BasicHttpBinding()).At("Soap11"),
                            WcfEndpoint.BoundTo(new WSHttpBinding()).At("Soap12")
                        )
            ),
    

    And here’s the generic registration.

    Classes.FromThisAssembly()
    .Where(t => Attribute.IsDefined(t, typeof(StandardServiceAttribute)))
    .WithService.Select((t, _) => t.GetInterfaces().Where(i => Attribute.IsDefined(i, typeof(ServiceContractAttribute),false)))
    .Configure
    (cr => 
        cr.AsWcfService(
            new DefaultServiceModel()
                .Hosted()
                .PublishMetadata(x => x.EnableHttpGet())
                .AddEndpoints(
                    WcfEndpoint.BoundTo(new BasicHttpBinding()).At("Soap11"),
                    WcfEndpoint.BoundTo(new WSHttpBinding()).At("Soap12")                       
                )
            )
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.