Silverlight OOB应用程序正在使用WCF服务 [英] Silverlight OOB App consuming WCF Service

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

问题描述

好吧......这很令人沮丧,我觉得这个问题很荒谬,但是我看不到我不能做到这一点。



我有一个Silverlight 5 OOB应用程序,它在同一解决方案中具有对WCF服务的服务引用。在主解决方案的属性中,我将应用程序添加到Silverlight应用程序选项卡。我还在OOB应用程序属性的WCF RIA服务链接中包含了WCF服务。我还修改了OOB应用程序中的ServiceReferences.ClientConfig文件。这是该文件的XML:



< configuration> 
< system.serviceModel>
< bindings>
< basicHttpBinding>
< binding name =BasicHttpBinding_IServiceNamemaxBufferSize =2147483647
maxReceivedMessageSize =2147483647>
< security mode =None/>
< / binding>
< / basicHttpBinding>
< / bindings>
< client>
< endpoint address =http:// localhost:55957 / Services / ServiceName.svc
binding =basicHttpBindingbindingConfiguration =BasicHttpBinding_IServiceName
contract =ServiceName.IServiceNamename =BasicHttpBinding_IServiceName/>
< / client>
< /system.serviceModel>





现在棘手的部分是在代码中访问该服务。使用using语句或直接变量声明的代码中无法访问服务引用。我不知道我做错了什么。无论是OOB应用程序的配置还是我缺少的WCF服务项目中的配置文件。



你们中的任何人都制作了一个OOB Silverlight 5应用程序适用于网络服务?我可以使用一些帮助。

解决方案

我在解决方案中添加了业务层项目。此业务层具有服务引用的实例,通过此实例,OOB应用程序可以访问服务的方法。看起来Silverlight迫使设计模型严格控制MVC。



无论如何,这就是我所做的。如果有人有不同的解决方案,请告诉我。谢谢大家!


ok ... this is frustrating and I feel ridiculous for asking this question, but I do not see where I CAN'T do this.

I have a Silverlight 5 OOB app that has a Service Reference to the WCF Service in the same solution. In the main solution's properties, I added the application to the Silverlight Applications tab. I also included the WCF Service in the WCF RIA Services link in the OOB Application's properties. I also modified the ServiceReferences.ClientConfig file in the OOB App. Here's the XML for that file:

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IServiceName" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:55957/Services/ServiceName.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceName"
            contract="ServiceName.IServiceName" name="BasicHttpBinding_IServiceName" />
    </client>
</system.serviceModel>



Now the tricky part is accessing that service in code. The Service Reference is not accessible in code with either a using statement or direct variable declaration. I do not know what I doing wrong. Whether it's in the OOB App's configuration or a configuration piece in the WCF Service project that I am missing.

Have any of you out there made an OOB Silverlight 5 app that works with a web service? I could use some help please.

解决方案

I added a "Business Layer" project to the solution. This Business Layer has an instance of the Service Reference and through this instance, the OOB App has access to the methods of the Service. It looks like Silverlight forces the design model to be strictly MVC.

Anyway, that's what I have done. If anyone has a different solution, please let me know. Thanks folks!


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

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