Click here to Skip to main content
15,886,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 11-Jun-13 9:32am
v2
Comments
Finniusday 11-Jun-13 15:48pm    
I was able to get access in a Windows Forms Application after adding a test app to the solution. But I want the Silverlight OOB app to use the WCF services. Any help here would be greatly appreciated ... Thanks!
Idle_Force 12-Jun-13 0:48am    
Your service has to have the connection to the DB your running or the methods your silverlight app will call. In your silverlight app you make an instance of the serviceClient(pre-built after you update the service reference). Then all your methods are inside that instance - though the names are slightly different. Method named LoadDepartments(marked with the <operationalcontract()> attribute) would be LoadDepartmentsAsync with an event named LoadDepartmentsCompleted so you can subscribe to that and get the e.results from the LoadDepartmentsEventArgs parameter inside that routed event.
Finniusday 12-Jun-13 7:16am    
I am well aware of that ... I have a web app inside the solution that connects just fine and uses methods from the service. The problem is creating an instance of the Service in the OOB app. It does not recognize the Service Reference after I have added it to the OOB app.
Idle_Force 12-Jun-13 10:48am    
http://blog.virtual-olympus.com/blog/post/2011/04/10/Silverlight-4-Out-of-Browser%E2%80%93Windows-Authentication-Timeout.aspx

1 solution

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!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900