【问题标题】:Silverlight : WCF getting error on server but localhost works fineSilverlight:WCF 在服务器上出现错误,但 localhost 工作正常
【发布时间】:2012-05-02 18:31:04
【问题描述】:

我有 silverlight 应用程序,但出现此错误:

[Async_ExceptionOccurred]
Arguments: 
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.61118.00&File=System.dll&Key=Async_ExceptionOccurred INNER >System.ServiceModel.CommunicationException: [CrossDomainError]
Arguments: http://localhost/pthaba/SimpleWCF.svc
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.61118.00&File=System.ServiceModel.dll&Key=CrossDomainError ---> System.Security.SecurityException ---> System.Security.SecurityException: [Arg_SecurityException]
Arguments: 
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.61118.00&File=mscorlib.dll&Key=Arg_SecurityException

我有 WCF 服务并且在浏览器上运行良好。 我在根站点(WCF 服务所在的位置)上有如下所示的 clientacesspolicy.xml

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

  </cross-domain-access>
</access-policy>

我做错了什么? 有人可以帮帮我吗?

编辑:

在我的本地主机上工作正常,但在服务器上却不行。 Fiddler 看起来不错,没有错误。

我是否缺少一些 IIS 配置?

以上更多错误详情:

 at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at Pthaba.SimpleSVC.SimpleWCFClient.SimpleWCFClientChannel.EndGetGameLevelPlataforms(IAsyncResult result)
   at Pthaba.SimpleSVC.SimpleWCFClient.Pthaba.SimpleSVC.ISimpleWCF.EndGetGameLevelPlataforms(IAsyncResult result)
   at Pthaba.SimpleSVC.SimpleWCFClient.OnEndGetGameLevelPlataforms(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
ult)

【问题讨论】:

  • 您的策略文件在哪里?
  • 我经常使用fiddler来检查这类问题。如果路径正确等,您应该会看到对 ClientacessPolicy.xml 的请求。fiddler2.com/fiddler2
  • 嗨,策略文件位于根目录,就像我的 service.svc 一样
  • 为了确定,您的服务位于“pthaba”内,但 ClientacessPolicy 必须位于根目录,而不是 svc 文件所在的位置。它应该在 pthaba 文件夹所在的同一文件夹中。
  • 您找到解决方案了吗?我今天也遇到同样的问题?

标签: wcf silverlight silverlight-4.0 iis-7


【解决方案1】:

我遇到了同样的问题,并在这篇文章之后让我的工作:Making a Service Available Across Domain Boundaries

我不得不做出如下修改,有人在文章底部评论过:

<allow-from http-request-headers="*">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多