从Silverlight调用WCF服务 [英] Calling WCF Service from Silverlight

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

问题描述

我从silverlight调用了本地托管的wcf服务,但出现以下异常.

Im calling a locally hosted wcf service from silverlight and I get the exception below.

IV创建了一个clientaccesspolicy.xml,它位于我的主机的路由中.

Iv created a clientaccesspolicy.xml, which is situated in the route of my host.

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

尝试制作时发生错误 对URI的请求 " http://localhost:8005/Service1.svc ". 这可能是由于跨域 配置错误.请参阅 内部异常以获取更多详细信息. --->

An error occurred while trying to make a request to URI 'http://localhost:8005/Service1.svc'. This could be due to a cross domain configuration error. Please see the inner exception for more details. --->

{System.Security.SecurityException ---> System.Security.SecurityException: 安全错误.在 MS.Internal.InternalWebRequest.Send() 在 System.Net.BrowserHttpWebRequest.BeginGetResponseImplementation() 在 System.Net.BrowserHttpWebRequest.InternalBeginGetResponse(AsyncCallback 回调,对象状态) System.Net.AsyncHelper.<> c__DisplayClass4.b__3(Object sendState)-内部结束 异常堆栈跟踪--- System.Net.AsyncHelper.BeginOnUI(BeginMethod beginMethod,AsyncCallback回调, 对象状态) System.Net.BrowserHttpWebRequest.BeginGetResponse(AsyncCallback 回调,对象状态) System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteSend(IAsyncResult 结果) System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnSend(IAsyncResult 结果)}

{System.Security.SecurityException ---> System.Security.SecurityException: Security error. at MS.Internal.InternalWebRequest.Send() at System.Net.BrowserHttpWebRequest.BeginGetResponseImplementation() at System.Net.BrowserHttpWebRequest.InternalBeginGetResponse(AsyncCallback callback, Object state) at System.Net.AsyncHelper.<>c__DisplayClass4.b__3(Object sendState) --- End of inner exception stack trace --- at System.Net.AsyncHelper.BeginOnUI(BeginMethod beginMethod, AsyncCallback callback, Object state) at System.Net.BrowserHttpWebRequest.BeginGetResponse(AsyncCallback callback, Object state) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteSend(IAsyncResult result) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnSend(IAsyncResult result)}

关于进步的任何想法吗?

Any ideas on how to progress?

推荐答案

有一些调试技术

there are some debugging techniques listed here..one more useful post..

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

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