Are you using the latests WCF Facility (trunk)?  Did you look at the MEX and 
Discovery unit tests?

BTW you should FindCriteria.CreateMetadataExchangeEndpointCriteria to discover 
MEX.

Also, the WCF Facility can now resolve all A, B  & C (Address, binding, 
Contract) with  single discovery call.  All you need to do is use the 
WcfEndpoint.Discovered()

On Jul 28, 2010, at 11:05 PM, Adam Langley wrote:

> I have upgraded to 2.5b2, and have gotten a wee bit further, but still no 
> cigar.
> 
> The service host can now be created, however, it appears that not all my 
> endpoints are being created correctly - specifically the IMetaDataExchange 
> one.
> 
> Client Code:
> 
> FindResponse mexResponse = Discovery.Find(new 
> FindCriteria(typeof(IMetadataExchange)));
>            if (mexResponse.Endpoints.Count > 0)
>            {
>                if (null == endpointMetadata)
>                {
>                    CustomBinding binding = new CustomBinding(new 
> HttpTransportBindingElement());
> 
>                    MetadataExchangeClient mexClient = new 
> MetadataExchangeClient(binding);
> 
>                        MetadataSet metadata = 
> mexClient.GetMetadata(mexResponse.Endpoints[0].Address); // the address will 
> be 'http://localhost:81/MEX'
> 
>                        MetadataImporter importer = new WsdlImporter(metadata);
> 
>                        endpointMetadata = importer.ImportAllEndpoints();
>                }
>            }
> 
> The call to 'GetMetadata' fails, with 
>               $exception      {"Metadata contains a reference that cannot be 
> resolved: 'http://localhost:81/MEX'."}   System.Exception 
> {System.InvalidOperationException}
> 
> Because, on the server, Windsor fails to construct the MetadatExchange 
> endpoint ({"The type argument passed to the generic ChannelFactory class must 
> be an interface type."}) - it is attempting to create a ChannelFactory with 
> my concrete service type as the generic argument... which obviously isnt 
> possible because the argument needs to be an interface type.
> 
> Is this more obvious?
> 
> Adam Langley
> Senior Developer
> +64 9 486 9010
> [email protected]
> www.winscribe.com
> 
>  Please consider the environment before printing this email!
> 
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Adam Langley
> Sent: Thursday, 29 July 2010 1:30 p.m.
> To: [email protected]
> Subject: WcfFacility does not appear to be compatible with DiscoveryEndpoint
> 
> Im not sure how this is going wrong, but I have configured a Windsor
> component in my app.config, and a WCF Service. This service has an HTTP
> endpoint, and a MEX http endpoint, both of which are advertised via an
> HTTP 'discovery endpoint' (not UDP).
> 
> Note: My WCF config works without Windsor involved (using a simple
> ServiceHost).
> 
> The config is LIKE this (pseudo)
> 
> <service name="MyService"
> behaviorConfiguration="RemoteDiscoveryBehavior">
>        <endpoint name="customerClient" address=" IMyService"
>                  binding="wsHttpBinding"
>                  bindingConfiguration="wsHttpBindingInsecure"
>                  contract="IMyService"/>
> 
>        <!-- this is the endpoint address that must be configured in the
> ServiceRouter -->
>        <endpoint name="httpDiscoveryEpt"
>                  kind="discoveryEndpoint"
>                  bindingConfiguration="wsDualHttpBindingInsecure"
>                  binding="wsDualHttpBinding"
>                  address="Discovery"/>
> 
> 
>        <!-- this is used by the Router to extract the binding
> information -->
>        <endpoint address="MEX" binding="mexHttpBinding"
> contract="IMetadataExchange" />
> </service>
> 
> 
> My server code then looks like this:
> 
> var container = new WindsorContainer(new
> Castle.Windsor.Configuration.Interpreters.XmlInterpreter());
> 
> DefaultServiceHostFactory factory = new
> DefaultServiceHostFactory(container.Kernel);
> var gatewayHost = factory.CreateServiceHost("MyService", new Uri[] { new
> Uri("http://localhost:81/";) });
> gatewayHost.Open();
> 
> 
> The MyService component is instantiated by Windsor as soon as the
> service-host is created, but when the client attempts to perform a
> "Find()" to get the service information for the published endpoints, the
> client gets this error:
> 
> 
> {An ExceptionDetail, likely created by
> IncludeExceptionDetailInFaults=true, whose value is:
> System.Reflection.TargetInvocationException: Exception has been thrown
> by the target of an invocation. ----> System.InvalidOperationException:
> The type argument passed to the generic ChannelFactory class must be an
> interface type.
>   at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
>   at System.ServiceModel.ChannelFactory`1..ctor(String
> endpointConfigurationName, EndpointAddress remoteAddress)
>   at System.ServiceModel.ChannelFactory`1..ctor(String
> endpointConfigurationName)
>   at Castle.Proxies.ChannelFactory`1Proxy..ctor(IInterceptor[] , String
> )
>   --- End of inner ExceptionDetail stack trace ---
>   at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo
> method, Object[] args, SignatureStruct& signature, RuntimeType
> declaringType)
>   at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo
> method, Object[] args, SignatureStruct signature, RuntimeType
> declaringType)
>   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
>   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
> Binder binder, Object[] args, CultureInfo culture, Object[]
> activationAttributes)
>   at System.Activator.CreateInstance(Type type, BindingFlags
> bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[]
> activationAttributes)
>   at System.Activator.CreateInstance(Type type, Object[] args)
>   at Castle.DynamicProxy.ProxyGenerator.CreateClassProxyInstance(Type
> proxyType, List`1 proxyArguments, Type classToProxy, Object[]
> constructorArguments)
>   at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type
> classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions
> options, Object[] constructorArguments, IInterceptor[] interceptors)
>   at
> Castle.Facilities.WcfIntegration.Async.AsynChannelFactoryBuilder`1.Creat
> eChannelFactory(Type channelFactoryType, M clientModel, Object[]
> constructorArgs) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\Async\AsyncChannelFactoryBuilder.cs:line 52
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.CreateChannelC
> reator(Type contract, M clientModel, Object[] channelFactoryArgs) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.Generic.cs:line 134
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.GetChannel(M
> clientModel, Type contract, String configurationName) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.Generic.cs:line 114
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.GetChannel(Typ
> e contract, String configurationName) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.Generic.cs:line 85
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder.Castle.Facilitie
> s.WcfIntegration.IWcfEndpointVisitor.VisitConfigurationEndpoint(Configur
> ationEndpointModel model) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.cs:line 92
>   at
> Castle.Facilities.WcfIntegration.ConfigurationEndpointModel.Accept(IWcfE
> ndpointVisitor visitor) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\WcfEndpoint.cs:line 271
>   at
> Castle.Facilities.WcfIntegration.WcfEndpointBase.Castle.Facilities.WcfIn
> tegration.IWcfEndpoint.Accept(IWcfEndpointVisitor visitor) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\WcfEndpoint.cs:line 103
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder.GetEndpointChann
> elCreator(IWcfEndpoint endpoint, Type contract) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.cs:line 68
>   at
> Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.GetChannelCrea
> tor(M clientModel, Type contract, IWcfBurden& burden) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\AbstractChannelBuilder.Generic.cs:line 63
>   at
> Castle.Facilities.WcfIntegration.WcfClientActivator.CreateChannelCreator
> Internal[M](IKernel kernel, IWcfClientModel clientModel, ComponentModel
> model, IWcfBurden& burden) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\WcfClientActivator.cs:line 234
>   at
> Castle.Facilities.WcfIntegration.WcfClientActivator.CreateChannelCreator
> (IKernel kernel, ComponentModel model, IWcfClientModel clientModel,
> IWcfBurden& burden) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\WcfClientActivator.cs:line 226
>   at
> Castle.Facilities.WcfIntegration.WcfClientActivator.GetChannelCreator(Cr
> eationContext context, IWcfBurden& burden) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\WcfClientActivator.cs:line 126
>   at
> Castle.Facilities.WcfIntegration.WcfClientActivator.Instantiate(Creation
> Context context) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\WcfClientActivator.cs:line 76
>   at
> Castle.Facilities.WcfIntegration.WcfClientActivator.InternalCreate(Creat
> ionContext context) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Client\WcfClientActivator.cs:line 68
>   at
> Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(
> CreationContext context)
>   at
> Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationCo
> ntext context)
>   at
> Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationC
> ontext context)
>   at
> Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext
> context, Boolean track)
>   at
> Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext
> context)
>   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
> handler, Type service, IDictionary additionalArguments)
>   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
> handler, Type service)
>   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
> handler)
>   at Castle.MicroKernel.DefaultKernel.get_Item(String key)
>   at
> Castle.Facilities.WcfIntegration.WindsorInstanceProvider.GetInstance(Ins
> tanceContext instanceContext, Message message) in
> c:\temp\Code\Castle\Castle.Facilities.Wcf\src\Castle.Facilities.WcfInteg
> ration\Service\WindsorInstanceProvider.cs:line 74
>   at
> System.ServiceModel.Dispatcher.InstanceBehavior.GetInstance(InstanceCont
> ext instanceContext, Message request)
>   at System.ServiceModel.InstanceContext.GetServiceInstance(Message
> message)
>   at
> System.ServiceModel.Dispatcher.InstanceBehavior.EnsureServiceInstance(Me
> ssageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41
> (MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(
> MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31
> (MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(
> MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(
> MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11
> (MessageRpc& rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(
> MessageRpc& rpc)
>   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
> isOperationContextSet)}
> 
> 
> Any ideas?
> 
> Adam Langley
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/castle-project-users?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/castle-project-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to