Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Silverlight 4 Application with Custom USer controls not return data in browser

Posted on 2010-09-13
19
Medium Priority
?
367 Views
Last Modified: 2013-11-12
I'm using SL4 to create a widget framework, where several widgets are loaded onto the page on load.

The widgets use WCF to get their data (weather data, twitter feeds etc..). All widgets as well as the main framework page, are seperate projects in the solution. The Main framework page, has references to the different widget projects, for use as user controls on the page. So, I reference the project, then drag the control from the toolbox. All silverlight projects contact a WCF service on the ASP.NET web app.

This all works well OOB, but in the browser, none of the data is retrieved, the widgets just sit there trying to load data from the WCF service.

Is the a reason why this would work OOB, but not in browser? I'm using the client access policy file on the wwwroot folder, but still get no data.

Cheers
0
Comment
Question by:wint100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660450
can you give some more info, like what the user control is trying to do, how it communicates with the WCF service.
0
 
LVL 1

Author Comment

by:wint100
ID: 33660471
The user control is trying to contect the WCF Service on the Server ASP.NET, to retrieve weather info, RSS feeds etc.. When run OOB, or if running on localhost, the data is retrieved, but when run in browser on a client machine, the data is not retrieved.

The user control is host inside the silverlight client application, although I've just noticed on each usercontrol serviceconfig, that the endpoint is set for localhost:

<endpoint address="http://localhost:52878/Services/WeatherService.asmx"
                binding="basicHttpBinding" bindingConfiguration="WeatherServiceSoap"
                contract="WeatherService.WeatherServiceSoap" name="WeatherServiceSoap" />

Why would this still work OOB on remmote clients though??
0
 
LVL 1

Author Comment

by:wint100
ID: 33660484
I've also had to add all endpoints from widgets(user controls) to the client app to get it to work at all:

<client>
            <endpoint address="http://localhost:52878/Services/SilverlightService.svc"
                binding="customBinding" bindingConfiguration="CustomBinding_SilverlightService"
                contract="SilverlightService.SilverlightService" name="CustomBinding_SilverlightService" />
            <endpoint address="http://localhost:52878/Services/WeatherService.asmx"
                binding="basicHttpBinding" bindingConfiguration="WeatherServiceSoap"
                contract="WeatherService.WeatherServiceSoap" name="WeatherServiceSoap" />
          <endpoint address="http://localhost:52878/Services/SilvTwitService.svc"
        binding="customBinding" bindingConfiguration="CustomBinding_SilvTwitService"
        contract="SilvTwitSvc.SilvTwitService" name="CustomBinding_SilvTwitService" />
        </client>
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 1

Author Comment

by:wint100
ID: 33660509
It seems the issue it with a standard webservice(asmx) that link through to a web reference, for the weather service. The User contorl for weather contacts the asmx, whihc in turn gets data from a web reference, so this is where the lack of data exists, not in WCF.
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660534
are you getting any errors when calling the service ?? If it's working on local host and stops working when you deploy it, then it would be a security issue.
0
 
LVL 1

Author Comment

by:wint100
ID: 33660551
No errors, it just doesn't get any data. Why would it work OOB but not in browser though? Wouldn't security affect both?

It works for http://localhost/mypage.aspx but not http://{myipaddress}/mypage.aspx. Soe ven though both local, it doesn't like anything other than localhost, even on local machine.
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660574
then the problem will be with the service... if SL is not throwing up any errors then it is able to connect to the service but there it may not be ale to retrieve the data.

Also Do you have any error logging in place which might be swallowing the error thrown ??
0
 
LVL 1

Author Comment

by:wint100
ID: 33660586
Not at present, the app just continues to run, trying to fetch the data.

I'll have to play around with the asmx service. Is there a cross domain issue with asmx, like with WCF services?
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660622
Under normal scenarios there wont be any problem, unless you are explicitly set up the website to do so. I would say that you take a look at your service a bit closely , to see why it is not returning data or it is swallowing any exceptions it's encountering

If any exceptions is thrown in the service the it has to be brought to the UI side as a response or if in the case of WCF as a fault exception.
0
 
LVL 1

Author Comment

by:wint100
ID: 33660809
I've checked the web.config and there are no entries for the asmx service at all, should there be an endpoint and binding for asmx services?
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660857
i dont hink so. can you see what is authentication mdoe for this web service ?
0
 
LVL 1

Author Comment

by:wint100
ID: 33660870
Security Mode is set to "None"
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660914
i think then the problem is with your service. Either it's not able to contact the data store from where you are getting the data from , and whatever the error that is happening is not getting propagated to the UI. So from the UI it looks like no data is retrieved.
0
 
LVL 1

Author Comment

by:wint100
ID: 33660922
Why would it work OOB on the remote client though?
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33660957
not sure... are you able to identify which is the service request that is failing ??? is it the web service or the WCF service..By looking through the endpoints i saw that you are using basicHttp for web service while custom for the other.. can you try making these also basicHTTP and try...
0
 
LVL 1

Author Comment

by:wint100
ID: 33660962
It is the web service that is failing, WCF seems ok.
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 2000 total points
ID: 33661040
can you try putting some log writing to the event log or something to see if the call from the UI really comes there or not..not sure why it's working from OOB but not from IE.

> add an http execution timeout ( <httpRuntime executionTimeout="1000" /> ) in the  server(web.config under system.web) as well as the client code and see if it makes any difference

> Please try this page which helps in finding such connectivity issues http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx
0
 
LVL 1

Author Comment

by:wint100
ID: 33663886
Setup logging but got nothing. For my WCF Service I'm using the following to get the absolute path on the production server:


Uri address = new Uri(Application.Current.Host.Source, "../Services/Service.svc");
private SilverlightServiceClient dbAccess;

dbAccess = new SilverlightServiceClient("CustomBinding_Service", address.AbsoluteUri);

I copied the same principal for teh web service, and it seems to work well now.

Thanks for your help.
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33663934
Cool. Good one!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question