积极答复者
WCF服务实例化客户端时出现keynotfound错误

问题
答案
-
在不同应用程序类型中,不一定支持所有的binding,像windows phone貌似只支持basicHttpBinding,我当是在服务端使用的是wsHttpBinding,所以引用时不能生成完整的客户端config文件,所以也就出现keynotFound异常
- 已标记为答案 bianchunlei 2012年4月17日 0:13
全部回复
-
引用服务完成后还有如下警告:
警告 1 自定义工具警告: Endpoint 'WSHttpBinding_UserService' at address 'http://localhost/UserService' is not compatible with Silverlight 3. Skipping...
警告 2 自定义工具警告: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
-
在对ServiceReferences.ClientConfig文件做了简单配置后,又显示如下错误:
Could not find default endpoint element that references contract 'UserService.IUserService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
配置如下:
<configuration>
<system.serviceModel>
<client><endpoint address="http://localhost/UserService"
binding="wsHttpBinding"
contract="NotificationService.IUserService" />
</client>
</system.serviceModel>
< /configuration> -
添加bindingConfiguration后能正常实例化了,如下。但我客户端是basicHttpBinding,服务端是wsHttpBinding,这样也可以?帮忙解释一下啊~
还有就是我服务端也没有bindingConfiguration啊,为什么客户端非要要呢?这个是干嘛的?
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8">
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<client><endpoint address="http://localhost/UserService"
bindingConfiguration="BasicHttpBinding_IService1"
binding="basicHttpBinding"
contract="UserService.IUserService" />
</client>
</system.serviceModel>
</configuration> -
引用服务完成后还有如下警告:
警告 1 自定义工具警告: Endpoint 'WSHttpBinding_UserService' at address 'http://localhost/UserService' is not compatible with Silverlight 3. Skipping...
警告 2 自定义工具警告: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
Frank Xu Lei--谦卑若愚,好学若饥
[老徐的网站]:http://www.frankxulei.com/[老徐的博客]:http://54peixun.com/Author/frankxulei
微软WCF中文技术论坛
微软WCF英文技术论坛
Windows Azure中文技术论坛 -
在不同应用程序类型中,不一定支持所有的binding,像windows phone貌似只支持basicHttpBinding,我当是在服务端使用的是wsHttpBinding,所以引用时不能生成完整的客户端config文件,所以也就出现keynotFound异常
- 已标记为答案 bianchunlei 2012年4月17日 0:13