3

Why I start my wcf service at localhost:53776/MyService.svc I get this error in the wcf test client.

This operation is not supported in the WCF client:

[ServiceContract]
public interface ILSKTicketService
{
    [OperationContract]
    Task UploadLDTTickets(LDTTicketUploadDTO[] tickets);
}

Why is this type not supported?

How else can I test my Service endpoint?

enter image description here

Pascal
  • 10,107
  • 18
  • 83
  • 180

1 Answers1

2

First, you should ask yourself if you really need to return a Task as return type, since there are other complications implied.

Second (and mainly what you asked), beside using the standard WCFTestClient, you can create a separate application, add a Service Reference to your end point ( https://msdn.microsoft.com/en-us/library/bb628652.aspx ) and then using the generated client to test your calls ( https://msdn.microsoft.com/en-us/library/bb386386.aspx ) with more flexibility than what is offered from WCFTestClient.

Saverio Terracciano
  • 3,781
  • 1
  • 29
  • 41
  • Ditto Task return type. How is a server going to communicate back that the task has finished? Tasks are usually generated on the client proxy interface and are used to wait until the call itself has returned. – GazTheDestroyer May 26 '15 at 08:23
  • Probably he wanted to implement the async/await pattern because this Upload I can infer from the method name might be a lengthy operation, but he should do that on the client side of his architecture if that's his only requirement. – Saverio Terracciano May 26 '15 at 08:28
  • @GazTheDestroyer right these are separated processes how could the client know. – Pascal May 26 '15 at 08:32
  • The Upload is an insert into 10 sql tables via EF. – Pascal May 26 '15 at 08:33
  • @Pascal: A task represents a promise to do some work. How will your separate process notify the original process when the work is complete?This would require a duplex WCF contract. – GazTheDestroyer May 26 '15 at 08:37
  • When I remove the Task stuff on server side and rename also my method (without async at the end) and do a refresh service with the test client I still see UploadLDTTicketsASYNC in the test client? What is going on? – Pascal May 26 '15 at 08:39
  • You have created an Async method using async wait pattern it s only logical to have an async version of your method – Coder1409 May 26 '15 at 09:04
  • The default WCF project, always creates an async instance of all your methods on its own. But you will notice that invoking those will throw a not implemented exception (unless you explicitly implement those). – Saverio Terracciano May 26 '15 at 09:08