Question

Runtime Context: a WCF service used WSDualHttpBinding running on Linux by Mono. I use app.config ,create a EndPoint used WSDualHttpBinding

app.config for service (partial)

 <endpoint address="http://192.168.0.101:8889"
              binding="wsDualHttpBinding" bindingConfiguration="wsDualHttp_Binding"
              contract="DynIPServiceContract.IDynIPService" />

The service Code:

     static void Main(string[] args)
    { 
        try
        {
            ServiceHost sh = new ServiceHost(typeof(DynIPService.DynIPService));
            sh.Open();
            foreach (var ep in sh.Description.Endpoints)
            {
                Console.WriteLine("Address: {0}, ListenUri: {1}, ListenUriMode: {2} ", ep.Address, ep.ListenUri, ep.ListenUriMode);
            }
            Console.WriteLine("Service is running");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error:" + ex.Message);
            throw;
        }
        finally
        {
           Console.ReadKey();
        }
    }

Exception: The default value for property 'textEncoding' has a different type than the one of the property itself: expected System.Text.Encoding but was System.String (About the detail info, please take a look at the snapshot of exception) enter image description here

Was it helpful?

Solution

Well, I just had a quick look at the code and that exception should actually be the least of your problems ;-)

The real problem is that WSDualHttpBinding is not yet supported in Mono.

CreateBindingElements() is an important abstract method in System.ServiceModel.Channels.Binding which must be implemented by a binding.

mcs/class/System.ServiceModel/System.ServiceModel/WSDualHttpBinding.cs has last been changed in 2008 and it's simply throwing a NotImplementedException:

https://github.com/mono/mono/blob/master/mcs/class/System.ServiceModel/System.ServiceModel/WSDualHttpBinding.cs#L140

I must admit that I also haven't used WSDualHttpBinding on Windows before, so I don't know which binding elements it is using (and whether they're already implemented in Mono). These binding elements provide the core functionality, so it's hard to say how long it would take to implement this binding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top