1

为长篇道歉,但我想包含尽可能多的信息。所以我几天来一直在努力让我的 WCF 服务与我的 silverlight 应用程序正常工作。我最初部署了它,一切运行顺利。

但是,在我对其中一种方法进行更新之后,它就没有用了。我使用 SVN 来存储我的工作,甚至回到项目的以前版本并重新部署它并没有帮助。请有人可以帮助我:(

如果我通过 VS2012 运行我的 silverlight 应用程序,它可以正常工作,所有对服务的调用都按要求工作并检索正确的信息。但是,如果我在部署 silverlight 应用程序后触发相同的调用,我会收到以下错误之一:

 An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.

   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at OrionDashboard.OrionWebService.GetTestDataCompletedEventArgs.get_Result()
   at OrionDashboard.MonthlyOverview.OrionWebService_GetTestDataCompleted(Object sender, GetTestDataCompletedEventArgs e)
   at OrionDashboard.OrionWebService.OrionWebServiceClient.OnGetTestDataCompleted(Object state)

或者

[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=4.0.51204.0&File=System.dll&Key=Async_ExceptionOccurred   at 

与其他错误消息的 onComplete 事件错误对应的其余错误。

再次,这仅在将其部署到服务器上的 IIS 时发生,并且仅在我将更新重新部署后才开始发生

我使用了 VS2012 中包含的 WCF Storm 和 WCF 测试客户端来测试通过网络部署的服务,并且所有合同都返回了所有内容,没有任何问题。

这是 ServiceReferences.ClinetConfig:

<configuration>
<system.serviceModel>
    <bindings>
        <customBinding>
            <binding name="CustomBinding_OrionWebService">
                <binaryMessageEncoding />
                <httpTransport maxReceivedMessageSize="2147483647"
                               maxBufferSize="2147483647" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:53493/OrionWebService.svc" 
                  binding="customBinding" 
                  bindingConfiguration="CustomBinding_OrionWebService"
                  contract="OrionWebService.OrionWebService"
                  name="CustomBinding_OrionWebService" />
    </client>
</system.serviceModel>

从我引用服务项目时自动生成的内容来看,我根本没有对此进行任何更改。我认为可能是这一行:“http://localhost:53493/OrionWebService.svc”

因为在提琴手中,我在 crossdomain.xml 和 clientaccesspolicy.xml 上收到以下错误

[Fiddler] 到 localhost 的套接字连接失败。错误代码:10061。无法建立连接,因为目标机器主动拒绝它 [::1]:53493

但是,当我将 xap 更改为 zip 文件并修改 ServiceReference.ClientConfig 以指向相同的服务地址时,如果您想检查您的服务,例如“http://ServerName/OrionDashboard/OrionWebService.svc”,我仍然会得到来自silverlight的相同错误,然后从两个文件中获得404错误。

这是web.config:

    <?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
    <system.web>
        <compilation debug="true"
                     targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
            <customBinding>
                <binding name="OrionDashboard.Web.OrionWebService.customBinding0">
                    <binaryMessageEncoding />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
                                   multipleSiteBindingsEnabled="true" />
        <services>
            <service name="OrionDashboard.Web.OrionWebService">
                <endpoint address="" 
                          binding="customBinding" 
                          bindingConfiguration="OrionDashboard.Web.OrionWebService.customBinding0"
                          contract="OrionDashboard.Web.OrionWebService" />
                <endpoint address="mex" 
                          binding="mexHttpBinding"
                          contract="IMetadataExchange" />
            </service>
        </services>
    </system.serviceModel>
</configuration>

与 ServiceReference 一样,web.config 也被单独留下,因为我真的不明白它的大部分含义。但是当我第一次部署 silverlight 应用程序时,我将其保留原样,并且如前所述,它当时运行良好。

  • 我不相信它是一个数据库问题,因为它在本地运行没有任何问题,并且该服务也使用来自已部署服务的正确数据进行响应。

  • 该服务似乎运行良好,WCF 测试客户端或 WCF Storm 应用程序均未报告任何问题

  • 在 VS2012 中,当发布 wcf 服务时,它不会将服务与客户端分开,也不会创建 crossdomain.xml 或 clientaccesspolicy.xml,所以我在发布后手动添加了它们。不确定这是否可能是原因?

我完全迷失了,到目前为止我发现的所有工作都对我不起作用。请有人至少可以指出我正确的方向吗?

4

0 回答 0