Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service - Backward compatibility issue

I'm just getting into creating some WCF services, but I have a requirement to make them backward compatible for legacy (.NET 1.1 and 2.0) client applications.

I've managed to get the services to run correctly for 3.0 and greater clients, but when I publish the services using a basicHttpBinding endpoint (which I believe is required for the compatibility I need), the service refactors my method signatures. e.g.

public bool MethodToReturnTrue(string seedValue);

appears to the client apps as

public void MethodToReturnTrue(string seedValue, out bool result, out bool MethodToReturnTrueResultSpecified);

I've tried every configuration parameter I can think of in the app.config for my self-hosting console app, but I can't seem to make this function as expected. I suppose this might lead to the fact that my expectations are flawed, but I'd be surprised that a WCF service is incapable of handling a bool return type to a down-level client.

My current app.config looks like this.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>  
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="MyServiceTypeBehaviors" Name="MyCompany.Services.CentreService.CentreService">
        <clear />
        <endpoint address="http://localhost:8080/CSMEX"    binding="basicHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
        <endpoint address="http://localhost:8080/CentreService" binding="basicHttpBinding" bindingName="Compatible" name="basicEndpoint" contract="MyCompany.Services.CentreService.ICentreService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors" >
            <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Can anyone advise, please?

like image 422
ZombieSheep Avatar asked Aug 08 '08 12:08

ZombieSheep


People also ask

What is a backwards compatibility issue?

Backward compatible (also known as downward compatible or backward compatibility) refers to a hardware or software system that can successfully use interfaces and data from earlier versions of the system or with other systems.

Is ASP Net backwards compatible?

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework. In other words, apps and components built with previous versions will work without modification on the . NET Framework 4.5 and later versions.


1 Answers

Ah, this is killing me! I did this at work about 3 months ago, and now I can't remember all the details.

I do remember, however, that you need basicHttpBinding, and you can't use the new serializer (which is the default); you have to use the "old" XmlSerializer.

Unfortunately, I don't work at the place where I did this anymore, so I can't go look at the code. I'll call my boss and see what I can dig up.

like image 177
Esteban Araya Avatar answered Oct 26 '22 22:10

Esteban Araya