Sea*_*anH 1 c# wpf nuget servicestack
在继续学习和使用ServiceStack时,我正在尝试使用ac#/ WPF应用程序来使用hello服务.
我已经完成了使用NuGet安装所需文件的预期步骤:
PM> install-package servicestack.common
Run Code Online (Sandbox Code Playgroud)
我相信我已经导入了正确的命名空间:
using ServiceStack.Common;
using ServiceStack.Common.ServiceClient.Web;
Run Code Online (Sandbox Code Playgroud)
然而,当我尝试按照我在Stack和Github上找到的示例时,VS10报告无法找到类型或命名空间.
var client = new JsonServiceClient("http://172.16.0.15/");
Run Code Online (Sandbox Code Playgroud)
我也无法使用我认为完全限定的名称创建此对象:
var client = new ServiceStack.ServiceClient.web.JsonServiceClient . . .
Run Code Online (Sandbox Code Playgroud)
是否有必须安装的另一个包或必须进行的另一个引用才能使用此类?
更新:
达林建议的完全限定类型似乎没有办法:
var client = new ServiceStack.ServiceClient.Web.JsonServiceClient("http://172.16.0.15/");
Run Code Online (Sandbox Code Playgroud)
我仍然得到VS10报告:
"The type or namespace name 'ServiceClient' does not exist in the namespace 'ServiceStack'.... "
Run Code Online (Sandbox Code Playgroud)
正确的命名空间是:
using ServiceStack.ServiceClient.Web;
Run Code Online (Sandbox Code Playgroud)
不是:
ServiceStack.Common
Run Code Online (Sandbox Code Playgroud)
它不是:
ServiceStack.Common.ServiceClient.Web
Run Code Online (Sandbox Code Playgroud)
它不是:
ServiceStack.ServiceClient.web
Run Code Online (Sandbox Code Playgroud)
因此,要么使用using关键字将正确的命名空间带入范围,要么完全限定类型:
var client = new ServiceStack.ServiceClient.Web.JsonServiceClient("http://172.16.0.15/");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1734 次 |
| 最近记录: |