Kieron Lanning

Hi all,

When getting the available bindings from a running service, the custom chunking binding from the Windows Sdk shows up in the ServiceEndpoint collection returned as a NetTcpBinding, not a TcpChunkingBinding.

Does anyone know how to get the correct bindings out of the MEX data

Thanks,

Kieron



Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Martin Petersen-Frey - MSFT

Hi,

To answer your question, meta data does not contain the binding name you use in your service. It just contains the contents of the CustomBinding elements. When svcUtil.exe consumes the contents of a binding to create a client config it will do one of 2 things: it will create an equivalent CustomBinding, OR if the BindingElements it sees correspond to the settings in a StandardBinding, it will put that StandardBinding in instead. This simplifies the resulting config considerably. Without seeing your config, I can't say for sure, but I suspect your binding is equivalent to what's in the StandardBinding you're getting.

The question is: Does your client work with your service. If not there's a problem.

Feel free to post your configs if things aren't working or you suspect incorrect behavior.






Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

Hi,

I'm affriad there is no config and the client does not work with the service.

The service is dynamically hosted via a factory pattern from another service. The client asks for contract type and the service dynamically hosts it, it works great except with any kind of custom binding out of the norm...i.e. the chunking channel.

Thanks,

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Brian McNamara - MSFT

The problem is that the binding element in this sample does not do policy import/export. (I am unsure if this omission was intentional or not; I may file a bug against the sample.) As a result, it does not show up in the service metadata (WSDL), which means svcutil will not generate a compatible proxy.

(A sample that does do policy for a BindingElement is this one: http://msdn2.microsoft.com/en-us/library/ms751458.aspx, it may be useful to read about that portion of that sample for some background, or http://msdn2.microsoft.com/en-us/library/ms733096.aspx for the general topic.)

Anyway, that explains the behavior you are seeing; in order to get metadata/client generation to work, you'd need to add the policy.






Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

OK, that makes sense. It's a shame that it works that way by default, means much more work for the developers on the other end now.

I'll try out the policy code and see if it works.

Thanks for you're help,

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

Hi,

Do you have a complete example of specifying the right bits in the right places for a custom binding to be correclty transfered via MEX to the client. All the samples I've found are somewhat lacking, in that they show a very small sample of useless data.

Also, I need to know how to specify things like the custom BindingElementExtensionElement in code, not in config...

Thanks,

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Brian McNamara - MSFT

Again, see the compression encoder sample I pointed out in a prior post. It has a BindingElement that implements IPolicyExportExtension and an IPolicyImportExtension for use by svcutil. You could copy those parts practically verbatim to use on the ChunkingChannel sample.

http://msdn2.microsoft.com/en-us/library/ms751458.aspx






Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

But how do I specifiy the following section in code:

<extensions>

<bindingElementExtensions>

<add name="gzipMessageEncoding"

type="Microsoft.ServiceModel.Samples.GZipMessageEncodingElement, GZipEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />

</bindingElementExtensions>

</extensions>

I can't seem to locate any reference to adding these anywhere other than in config.

Thanks again Brian, I seriously appriciate your help!

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Brian McNamara - MSFT

If you aren't going to use <gzipMessageEncoding> in the config file, then you don't need to register it.

If you want to use <gzipMessageEncoding>, but not put the extension in the config file, well, I'm not sure it's possible. I think possibly the extension must be in either the app's config file or else in machine.config. If there was a way to do it in code, it would involve code like
ExtensionsSection es = ConfigurationManager.GetSection("system.serviceModel/extensions") as ExtensionsSection;
es.BindingElementExtensions.Add(new ExtensionElement("gzipMessageEncoding", typeof(GzipMessageEncodingElement).AssemblyQualifiedName));
but when I tried doing that inside a custom ServiceHost subclass where I overrode ApplyConfiguration() (to do that code and then call base.ApplyConfiguration() afterwards), I got an error that the config was read-only. I don't know enough about config to say definitively that it's not possible, but if it is possible, I don't know how.






Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

Hi Brian, it wasn't the gzipMessageEncoding I was interested in, I just used that as an example. But thanks for your help. It's a shame no-one seems to know how to do this.

Unfortunatly my Custom channel still comes down as a CustomBinding instead of the actual type.

Thanks for your help anyway Brian,

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Brian McNamara - MSFT

Does it come as a 'working' CustomBinding That is, you get the ChunkingChannel

If so, that is expected. If you want it to be a 'standard binding' on the client rather than a CustomBinding, then you also must implement an IWsdlImportExtension to do it, e.g. by subclassing

http://msdn2.microsoft.com/en-us/library/system.servicemodel.channels.standardbindingimporter.aspx

so that ImportEndpoint looks at the set of binding elements and if it recognizes the set as something that corresponds to your standard binding, pokes in the right value for that binding.

I am disappointed that we don't appear to have a sample that does this, I may file a bug against samples.






Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Brian McNamara - MSFT

Aha, we do have a sample that generates a user-defined non-CustomBinding binding in the svcutil-generated client, it is this one: http://msdn2.microsoft.com/en-us/library/ms751494.aspx. See especially the UdpBindingElementImporter.




Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

Kieron 1980

Hi Brian,

I've just tried the UDP sample, using MEX to get the EPAs the UDP binding comes out as a CustomBinding. While this works with this sample, the chunking channel doesn't appear to work in the same way. When its done using the MEX information, it fails.

Thanks again for your time and help,

Kieron





Re: Windows Communication Foundation (Indigo) MEX and Custom Binding

dvdfvdwe

Hi ,

Any body got the solution for WSDL generation of customTOken service , please help me . I tried to do all the things mentioned by microsoft to export Metadata.I tried to implement IPolicyExportExtension by

creating custombinding element inheriting from BindingElement base class. Can anybody tell me how to embed this with custom token exmple given in the Technology samples

No luck . Please help me out