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

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
LVL 1
wint100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gautham JanardhanCommented:
can you give some more info, like what the user control is trying to do, how it communicates with the WCF service.
0
wint100Author Commented:
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
wint100Author Commented:
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
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

wint100Author Commented:
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
Gautham JanardhanCommented:
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
wint100Author Commented:
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
Gautham JanardhanCommented:
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
wint100Author Commented:
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
Gautham JanardhanCommented:
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
wint100Author Commented:
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
Gautham JanardhanCommented:
i dont hink so. can you see what is authentication mdoe for this web service ?
0
wint100Author Commented:
Security Mode is set to "None"
0
Gautham JanardhanCommented:
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
wint100Author Commented:
Why would it work OOB on the remote client though?
0
Gautham JanardhanCommented:
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
wint100Author Commented:
It is the web service that is failing, WCF seems ok.
0
Gautham JanardhanCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wint100Author Commented:
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
Gautham JanardhanCommented:
Cool. Good one!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.