Nothing special should be needed for the builder.  Just make sure you expose 
the MEX endpoints properly.  Remember to add a base address to the trust 
endpoint.

On May 17, 2011, at 5:47 PM, Scott_M wrote:

> Is there anything special I need to do for my custom
> AbstractServiceHostBuilder<T> to support IMetadataExchange
> (svcutil.exe support)?   I see the following error in the server event
> log when attempting to add wcf service references that involve my
> token issuer
> 
> TypeName: System.InvalidCastException
> TypeAssembly: mscorlib, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089
> Message: Unable to cast object of type
> 'Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract' to
> type 'System.ServiceModel.Description.IMetadataExchange'.
> Source: System.ServiceModel
> TargetSite: System.Object SyncInvokeGet(System.Object,
> System.Object[], System.Object[])
> StackTrace:    at SyncInvokeGet(Object , Object[] , Object[] )
>   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
> instance, Object[] inputs, Object[]& outputs)
>   at
> System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
> rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
> rpc)
>   at
> System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
> rpc)
>   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
> isOperationContextSet)
> 
> Here is my service host builder:
> 
> public class WSTrustServiceHostBuilder :
> AbstractServiceHostBuilder<WSTrustServiceModel>
>    {
>        public WSTrustServiceHostBuilder(IKernel kernel)
>            : base(kernel)
>        {
>        }
> 
> 
>        protected override ServiceHost
> CreateServiceHost(ComponentModel model, WSTrustServiceModel
> serviceModel,
> 
> params Uri[] baseAddresses)
>        {
>            return CreateServiceHost(model,
> GetEffectiveBaseAddresses(serviceModel, baseAddresses));
>        }
> 
>        protected override ServiceHost
> CreateServiceHost(ComponentModel model, params Uri[] baseAddresses)
>        {
>            ServiceHost host = null;
> 
> 
> Debug.WriteLine("WSTrustServiceHostBuilder.CreateServiceHost:");
>            Debug.WriteLine(String.Format("model.Implementation = ",
> model.Implementation));
> 
>            if
> (typeof(WSTrustServiceContract).IsAssignableFrom(model.Implementation))
>            {
>                var contract =
> Kernel.Resolve<WSTrustServiceContract>(model.Name);   //be sure to
> register a SecurityTokenServiceConfiguration as it is a dependency of
> WSTrstServiceContract
> 
>                //var contract =
> Kernel.Resolve<IWSTrust13SyncContract>(model.Name);
> 
>                host = new WSTrustServiceHost(contract,
> baseAddresses);
>                return host;
>            }
> 
>            host = new DefaultServiceHost(model, baseAddresses);
> 
>            Debug.WriteLine(String.Format("host type = ",
> host.GetType()));
> 
>            return host;
>        }
> 
> 
>        protected override ServiceHost CreateServiceHost(Type
> serviceType, params Uri[] baseAddresses)
>        {
>            return new DefaultServiceHost(serviceType, baseAddresses);
>        }
>    }
> }
> 
> Note, we are currently running Castle WCF Integration 1.0.3.0
> 
> 
> scottm
> 
> 
> -- 
> 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