简体   繁体   English

WCF向后兼容性问题

[英]WCF Backward Compatibility Issue

I have a WCF service that I have to reference from a .net 2.0 project. 我有一个WCF服务,必须从.net 2.0项目中引用。

I have tried to reference it using the " add web reference " method but it messes up the params. 我尝试使用“ 添加网络引用 ”方法来引用它,但它弄乱了参数。

For example, I have a method in the service that expects a char[] to be passed in, but when I add the web reference, the method expects an int[] . 例如,我在服务中有一个方法希望传递char[] ,但是当我添加Web引用时,该方法期望一个int[]

So then I tried to setup svcutil and it worked... kind of. 因此,我尝试设置svcutil并使其工作……。
I could only get the service class to compile by adding a bunch of .net 3.0 references to my .net 2.0 project. 我只能通过向.net 2.0项目添加一堆.net 3.0引用来编译服务类。 This didn't sit well with the architect so I've had to can it (and probably for the best too). 这与建筑师的关系不佳,所以我必须做到这一点(也许也是最好的)。

So I was wondering if anyone has any pointers or resources on how I can setup a .net 2.0 project to reference a WCF service . 所以我想知道是否有人对如何设置.net 2.0项目以引用WCF服务有任何指示或资源。

One of those instances that you need to edit the WSDL. 您需要编辑WSDL的那些实例之一。 For a start a useful tool 首先是有用的工具

http://codeplex.com/storm http://codeplex.com/storm

What binding are you using - I think if you stick to the basicHttp binding you should be able to generate a proxy using the "add web reference" approach from a .net 2 project? 结合什么您使用的是 - 我想,如果你坚持basicHttp绑定,您应该能够产生使用“添加Web引用”的方法从.NET 2项目的代理?

Perhaps if you post the contract/interface definition it might help? 或许,如果你发布合同/接口定义它可能帮助?

Cheers Richard 干杯理查德

I was using the basicHttp binding but the problem was actually with the XMLSerializer. 我用的是basicHttp结合,但问题是实际与XMLSerializer的。 It doesn't properly recognize the wsdl generated by WCF (even with basicHttp bindings) for anything other than basic value types. 它不能正确识别超过基本值类型以外的任何通过WCF产生的(即使basicHttp绑定)的WSDL。

We got around this by added the reference to the 3.0 dll's and using the datacontract serializer. 我们得到了解决此通过添加参考3.0的DLL和使用datacontract串行器。

Thanks for the resource. 感谢您的资源。 It certainly helped me test out the webservice, but it didn't much help with using the WCF service in my .net 2.0 application. 它无疑帮助我测试了Web服务,但是在.net 2.0应用程序中使用WCF服务并没有多大帮助。

What I eventually ended up doing was going back to the architects and explaining that the 3.0 dll's that I needed to reference got compiled back to run on the 2.0 CLR. 我最终最终要做的是回到架构师那里,并解释说,我需要参考的3.0 dll已重新编译以在2.0 CLR上运行。 We don't necessarily like the solution, but we're going to go with it for now as there doesn't seem to be too many viable alternatives 我们不一定喜欢该解决方案,但由于似乎没有太多可行的选择,我们现在将继续使用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM