Reputation: 1955
Is there any way to generate only the task based async methods with svcUtil?
The reason is I have given WSDLs which I need to implement as a service. The easiest way seems to be to just add them as a service reference and implement the generated interface as a service. This works great as long as you stay synchronous but for async it obviously generates two methods with the same OperationContract
, which is invalid.
Other ways of fixing this dilemma are appreciated as well of course. My constraint is that I have to stick to the given WSDL files, so I can't generate the WSDL from the interface (yay -.-)
Regarding the duplicate claim: nope. This does not help at all. I played around with ConcurrencyMode and Task-based services now and there is a huge difference in performance between the two. For example: Shooting with 100 threads against either of these implementations,
public async Task<SomeObj> GetSomeObj(SomeReq request)
{
await Task.Delay(1000);
return SomeObj();
}
performs much better than
public SomeObj GetSomeObj(SomeReq request)
{
Thread.Sleep(1000);
return new SomeObj();
}
no matter what ConcurrencyMode is selected in the ServiceBehavior (which, funny enough, had only very little influence on the performance).
So the question still stands: how to generate a task-based service contract from a WSDL, because we can clearly show that they have superior performance (both when it comes to startup behaviour as well as predictability of runtime performance).
Upvotes: 1
Views: 969