如何使用Silverlight客户端调用WCF服务 [英] How to call WCF Service using Silverlight Client

查看:113
本文介绍了如何使用Silverlight客户端调用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai ....我有WCF服务和Silverlight作为客户端.我必须在IIS中托管WCF服务,因此我已将clientaccesspolicy.xml和crossdomainpolicy.xml添加到我的Service应用程序中.
在我的本地系统中(在IIS上托管之前),客户端和服务都工作正常,并且我通过创建虚拟目录在IIS上托管了WCFService.当我从Silverlight调用WCFService时,出现此错误消息....

""尝试向URI" http://sarathm.spaninfo.com/WcfService1/Service1.svc发出请求时发生错误.这可能是由于尝试跨站点访问服务而导致的.没有适当的跨域策略或不适合SOAP服务的策略的域方法,您可能需要联系服务的所有者以发布跨域策略文件并确保它允许与SOAP相关的HTTP标头该错误也可能是由于在Web服务代理中使用内部类型而不使用InternalsVisibleToAttribute属性而引起的.请参阅内部异常以获取更多详细信息.""

有人可以帮我这个忙吗?...

谢谢,
Sarath ....

解决方案

您之前已经发布了此问题.尚未解决?

sarath.mk写道:

http://sarathm.spaninfo.com/WcfService1/Service1.svc



1.您是否已将跨域策略复制到inetpub/wwwroot?
2.是否检查了Silverlight客户端中的Uri是否已映射到服务?
3.该服务可用吗?


您在silverlight客户端app.config文件中指定了哪个服务URI?您可以复制该uri并将其粘贴到浏览器中,并检查其是否可访问.

这意味着您在silverlight客户端中指定的服务URI错误.客户端中的服务URI与实际的服务URI不同.这就是为什么会出错的原因.将Silverlight客户端URI替换为实际的URI.

如果所有修复程序均无效,请尝试以下操作,

http://amiraryani.wordpress.com/tag/servicemodelreg/ [
Can anybody help me regarding this....

Thanks,
Sarath....

解决方案

You already posted this question before.Its not solved yet?

sarath.mk wrote:

http://sarathm.spaninfo.com/WcfService1/Service1.svc



1.Have you copied cross domain policy to inetpub/wwwroot?
2.Have you checked if the Uri in silverlight client is mapped to the service?
3.Is that service available?


What service URI you specified in silverlight client app.config file?Can you copy that uri and paste it in browser and check if its accessible.


That means that service URI specified in your silverlight client is wrong.Service URI in client and the actual service URI is different. Thats why its getting error.Replace the silverlight client URI with the actual one.

If all this fix not working then try this,

http://amiraryani.wordpress.com/tag/servicemodelreg/[^]


这篇关于如何使用Silverlight客户端调用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆