Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's how I got it working configuring through the code with no app.config file. </p> <p>One difference is I'm using the PublishMetadata method on DefaultServiceModel instead of registering that with the IServiceBehavior. To be honest, I'm not sure how Windsor would behave if the same interface is registered twice and it's not a decorator pattern (see <a href="http://mikehadlow.blogspot.com/2010/01/10-advanced-windsor-tricks-4-how-to.html" rel="nofollow">this post</a> about Windsor and decorators).</p> <p>The other difference is I'm specifying a unique address per service in the AddBaseAddress method. Each service needs a unique address, but you can expose multiple unique endpoints relative to that base address per service using the At() method on WcfEndpoint. (i.e. if you wanted to expose a BasicHttpEndpoint and a WSHttpEndpoint for the same service)</p> <pre><code>using System; using System.ServiceModel; using System.ServiceModel.Description; using Castle.Facilities.WcfIntegration; using Castle.MicroKernel.Registration; using Castle.Windsor; namespace DISandbox { public class Program { private static WindsorContainer _container; public static void Main(string[] args) { _container = new WindsorContainer(); _container.AddFacility&lt;WcfFacility&gt;(); ServiceDebugBehavior returnFaults = new ServiceDebugBehavior { IncludeExceptionDetailInFaults = true, HttpHelpPageEnabled = true, }; _container.Register( Component.For&lt;IServiceBehavior&gt;().Instance(returnFaults)); string baseAddress = "http://localhost:49246/"; _container.Register( Component .For&lt;IAccountDataService&gt;() .ImplementedBy&lt;AccountDataService&gt;() .AsWcfService(new DefaultServiceModel() .PublishMetadata(mex =&gt; mex.EnableHttpGet()) .AddBaseAddresses(baseAddress + "AccountDataService") .AddEndpoints(WcfEndpoint .ForContract&lt;IAccountDataService&gt;() .BoundTo(new WSHttpBinding()))), Component .For&lt;IInstitutionDataService&gt;() .ImplementedBy&lt;InstitutionDataService&gt;() .AsWcfService(new DefaultServiceModel() .PublishMetadata(mex =&gt; mex.EnableHttpGet()) .AddBaseAddresses(baseAddress + "InstitutionDataService") .AddEndpoints(WcfEndpoint .ForContract&lt;IInstitutionDataService&gt;() .BoundTo(new WSHttpBinding())))); Console.WriteLine("Press any key to exit..."); Console.ReadLine(); } } [ServiceContract] public interface IAccountDataService { [OperationContract] void DoStuff(); } public class AccountDataService : IAccountDataService { public void DoStuff() { } } [ServiceContract] public interface IInstitutionDataService { [OperationContract] void DoStuff(); } public class InstitutionDataService : IInstitutionDataService { public void DoStuff() { } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload