Zom*_*eep 9 .net c# wcf web-services backwards-compatibility
我刚刚开始创建一些WCF服务,但我要求它们向后兼容遗留(.NET 1.1和2.0)客户端应用程序.
我已经设法让服务正常运行3.0和更高版本的客户端,但是当我使用basicHttpBinding端点发布服务时(我认为这是我需要的兼容性所需),服务会重构我的方法签名.例如
public bool MethodToReturnTrue(string seedValue);
Run Code Online (Sandbox Code Playgroud)
在客户端应用程序中显示为
public void MethodToReturnTrue(string seedValue, out bool result, out bool MethodToReturnTrueResultSpecified);
Run Code Online (Sandbox Code Playgroud)
我已尝试在app.config中为我的自托管控制台应用程序考虑的每个配置参数,但我似乎无法按预期使此功能.我想这可能会导致我的期望存在缺陷这一事实,但我很惊讶WCF服务无法将bool返回类型处理为下级客户端.
我当前的app.config看起来像这样.
<?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>
Run Code Online (Sandbox Code Playgroud)
有人可以提出建议吗?
好的,我们需要在短期内解决这个问题,因此我们提出了“互操作”或兼容性层的想法。
基本上,我们所做的就是向项目添加传统的 ASMX Web 服务,并使用本机 WCF 调用从中调用 WCF 服务。然后,我们能够将适当的类型返回给客户端应用程序,而无需进行大量的重构工作。我知道这是一个很糟糕的解决方案,但它是我们对如此庞大的遗留代码库的最佳选择。额外的好处是它实际上效果出奇的好。:)
| 归档时间: |
|
| 查看次数: |
2396 次 |
| 最近记录: |