开发者

Why might VS "Add Service Reference" not generate interfaces for servicecontracts that svcutil recognizes just fine?

I have a WCF service that I'd like clients to be able to reference using Visual Studio's "Add Service Reference" feature. They've been able to recognize the metadata endpoint, the interfaces, methods and data types appear in the Add Service Reference dialog, and it appears to successfully generate the proxy without a hitch - but when viewing the generated code file or viewing the classes in the object browser, there is no service interface generated from the ServiceContract - only the DataContra开发者_如何学Ccts are represented. When I point svcutil at the same endpoint URL from the command line, the generated file does contain the interfaces.

  • The service itself has been used in production for a while and seems to work fine
  • It uses a custom binding, but the exact same binding configuration (and other config settings) are used by another service that seems to work fine with Add Service Reference
  • One thing that is different is that this service uses a custom behavior (an attribute derived from IServiceBehavior). The interface is also in a different assembly from the concrete service type, although so are the data contracts.

Update: What seems to be causing the problem, which I'd somehow overlooked, is that there are FaultContracts for some of the methods on this interface, and these FaultContracts are referencing an exception type that is [Serializable], not [DataContract] (as I think anything that derives from Exception must be). The exception type itself is represented in the generated code, but its public properties aren't (in either svcutil or ASR-generated code)


What seemed to be causing the problem, which I'd somehow overlooked, is that there are FaultContracts for some of the methods on this interface, and these FaultContracts are referencing an exception type that is [Serializable], not [DataContract] (as I think anything that derives from Exception must be). The exception type itself is represented in the generated code, but its public properties aren't (in either svcutil or ASR-generated code)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜