CSLA Light deploy problem

CSLA Light deploy problem

Old forum URL: forums.lhotka.net/forums/t/8200.aspx


zhangxijun posted on Wednesday, December 23, 2009

My computer's configuration:
OS: Windows XP Professional
web server: IIS5.1
csla light version: 3.8.1

I have just finished my project using csla light, and deployed to the IIS. When I use the address http://localhost/, it can open default page, and run correctly; but when I use the address http://192.168.0.9 (my computer's ip address)or http://127.0.0.1 , it just display the silverlight UI, but do not display any data(retrived by calling csla business object's method). When I use Visual studio 2008's "Add Service Reference" Dialog and input the address http://192.168.0.9/WcfPortal.svc, and it can also find the service. why???

I have removed the port number(:xxxx) from the servicereference.clientconfig file, and close the firewall.

I also try to deploy the csla sample project "CslaLight\cs\SimpleApp", and the same thing happened.  It pops up a "Data error" dialog.

I think that the wcf service configuration must have some problems, but I have no idea.

Thanks in advance!

 

RockfordLhotka replied on Wednesday, December 23, 2009

You are running into a cross-domain security policy that is built into Silverlight's networking stack.

You need to create a cross-domain policy file on your server to allow clients from other URL addresses to access your service.

Or you can change your clientconfig file to reference the service using the same URL from which you are launching the app.

zhangxijun replied on Wednesday, December 23, 2009

Thanks.

I just test the methods in my project. It seems that I must do the following items at the same time:

  1. create a cross-domain policy file on your server
  2. change servicereferences.clientconfig file from "<endpoint address=http://localhost/wcfportal.svc" to "<endpoint address=http://192.168.0.9/wcfportal.svc"

My application is not a traditional web application, it deployed on a test and measurement instrument that conforms to the LXI standard(http://www.lxistandard.org/). By using my application ,the instrument user can  changed the instrument's ip address, hostname, domain name, and so on.

To my project, the item 1 is not a problem, but item 2 restricts my web server's ip address to 192.168.0.9, this is not my wish, because my application user is permitted to  change the web server's ip address.

Is there a way to declare that endpoint's address is same to the web server's(which host the silverlight application) ip address?

Thanks!

zhangxijun replied on Thursday, December 24, 2009

After google for a while, I found the following content:

  1. http://stackoverflow.com/questions/373219/relative-url-in-wcf-service-binding
  2. http://smehrozalam.wordpress.com/2008/12/23/using-relative-urls-to-access-wcf-services-in-silverlight/

It seems that the only way to do that is by changing the csla's source code to adapte it..., but I dont know if it is possible but do not effect csla's other function. Can someone tell me what file I should change? It seems to be the function "protected virtual WcfPortal.WcfPortalClient GetProxy(){}" located in wcfproxy.cs, am I right?

I wish that is built in csla light if it is impossible.

Thanks!

RockfordLhotka replied on Thursday, December 24, 2009

You can subclass Csla.DataPortalClient.WcfProxy<T> on the client to create your own proxy class. In that class you can override the GetProxy() method, and in that override you can create the WCF proxy the way you want.

Copyright (c) Marimer LLC