ServiceStack:调用服务时出错

时间:2013-06-06 14:33:26

标签: compiler-errors servicestack

我已经实现了一个ServiceStack示例服务,就像在文档中一样 - github.com/ServiceStack/ServiceStack/wiki/Create-your-first-webservice

问题在于,当我尝试调用它时,我得到了这些错误:

"cannot convert from 'string' to 'ServiceStack.ServiceHost.IReturnVoid'"

The best overloaded method match for 'ServiceStack.ServiceClient.Web.ServiceClientBase.Get(ServiceStack.ServiceHost.IReturnVoid)' has some invalid arguments

我调用服务的代码:

var client = new JsonServiceClient("http://host:8080/");
HelloResponse response = client.Get(new Hello { Name = "World!" });

有人可以帮忙吗? 感谢。

1 个答案:

答案 0 :(得分:1)

HelloResponse response = client.Get<string>(new Hello { Name = "World!" });

你必须在这些泛型方法中指定返回类型。