I am consuming a predefined wsdl with svcutil a la:
svcutil some_service.wsdl
one of the methods generated has the following signature:
[System.ServiceModel.OperationContractAttribute(Action="http://ws.example.org/SubmitData", ReplyAction="*")]
SubmitDataResponse SubmitData( SubmitDataRequest request )
While scvutil from VS2010/.net35 generates only the above and VS has no problem lanuching the service, the svcutil program that is part of VS2012/.net45 also generates a method with the signature
[System.ServiceModel.OperationContractAttribute(Action="http://ws.example.org/SubmitData", ReplyAction="*")]
Task<SubmitDataResponse> SubmitDataAsync( SubmitDataRequest request );
This causes a run-time exception:
System.InvalidOperationException: Cannot have two operations in the same contract with the same name, methods SubmitDataAsync and SubmitData in type MyType violate this rule. You can change the name of one of the operations by changing the method name or by using the Name property of OperationContractAttribute.
I can work around this by deleting the Async appended methods or simply using svcutil from VS2010. But I am wondering why svcutil generates an interface that causes a runtime exception (is this a bug?), and whether there is something additional I am supposed to do to make it work.
The default behaviour appears to have been changed. If you provide the /syncOnly parameter it preserved the old behaviour for me.
/syncOnly - Generate only synchronous method
signature. Default: generate synchronous
and task-based asynchronous method
signatures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With