开发者

WCF 4.0, .NET 2.0 client and .NET types

This is my scenario:

  • WCF 4.0 service
  • .NET 2.0 client (that consumes the above service)

I need, let's say, to pass an array of NetworkInterfaces (System.Net.NetworkInformation.NetworkInterfaces) from the client to the service. A web reference wcfReference to WCF service has been added to the client side.

Service code:

public void StoreNetworkInterfaces(System.Net.NetworkInterfaces[] nwInterfaces)
{
...
}

Client code:

wcfService.StoreNetworkInterfaces(System.Net.NetworkInformation.NetworkInterfaces.GetAllNetworkInterfaces());

I'm getting:

Argument 1: cannot convert from 'System.Net.NetworkInformation.NetworkInterface[]' to 'WindowsFormsApplication1.wcfReference.NetworkInterface[]'

Same happens for any other types (.NET and non .NET types). I know this is the desired behaviour for a web service (interop) but the scope of my WCF is just serving to a client installer.

Manually changing开发者_Python百科 proxy code after each Web Reference update is definitively not a good choice for this project.

Any help or approach suggestion would be very appreciated.

Greets


A web-reference (2.0-style) doesn't have the "re-use types" option that full a WCF (3.0+) service-reference supports, so if you use the tooling you are going to have to accept the proxy types over the wire, and then transform them (perhaps AutoMapper) to/from the domain types.

Do not edit the reference file; that may be regenerated randomly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜