wint100
asked on
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
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
can you give some more info, like what the user control is trying to do, how it communicates with the WCF service.
ASKER
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="Weat herService Soap"
contract="WeatherService.W eatherServ iceSoap" name="WeatherServiceSoap" />
Why would this still work OOB on remmote clients though??
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"
contract="WeatherService.W
Why would this still work OOB on remmote clients though??
ASKER
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="Cust omBinding_ Silverligh tService"
contract="SilverlightServi ce.Silverl ightServic e" name="CustomBinding_Silver lightServi ce" />
<endpoint address="http://localhost:52878/Services/WeatherService.asmx"
binding="basicHttpBinding" bindingConfiguration="Weat herService Soap"
contract="WeatherService.W eatherServ iceSoap" name="WeatherServiceSoap" />
<endpoint address="http://localhost:52878/Services/SilvTwitService.svc"
binding="customBinding" bindingConfiguration="Cust omBinding_ SilvTwitSe rvice"
contract="SilvTwitSvc.Silv TwitServic e" name="CustomBinding_SilvTw itService" />
</client>
<client>
<endpoint address="http://localhost:52878/Services/SilverlightService.svc"
binding="customBinding" bindingConfiguration="Cust
contract="SilverlightServi
<endpoint address="http://localhost:52878/Services/WeatherService.asmx"
binding="basicHttpBinding"
contract="WeatherService.W
<endpoint address="http://localhost:52878/Services/SilvTwitService.svc"
binding="customBinding" bindingConfiguration="Cust
contract="SilvTwitSvc.Silv
</client>
ASKER
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.
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.
ASKER
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.
It works for http://localhost/mypage.aspx but not http://{myipaddress}/mypage.aspx.
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 ??
Also Do you have any error logging in place which might be swallowing the error thrown ??
ASKER
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?
I'll have to play around with the asmx service. Is there a cross domain issue with asmx, like with WCF services?
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.
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.
ASKER
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?
i dont hink so. can you see what is authentication mdoe for this web service ?
ASKER
Security Mode is set to "None"
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.
ASKER
Why would it work OOB on the remote client though?
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...
ASKER
It is the web service that is failing, WCF seems ok.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.Ho st.Source, "../Services/Service.svc") ;
private SilverlightServiceClient dbAccess;
dbAccess = new SilverlightServiceClient(" CustomBind ing_Servic e", address.AbsoluteUri);
I copied the same principal for teh web service, and it seems to work well now.
Thanks for your help.
Uri address = new Uri(Application.Current.Ho
private SilverlightServiceClient dbAccess;
dbAccess = new SilverlightServiceClient("
I copied the same principal for teh web service, and it seems to work well now.
Thanks for your help.
Cool. Good one!