Solved

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

Posted on 2010-09-13
19
357 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
  • 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now