Archived

This forum has been archived. Please start a new discussion on GitHub.

Silverlight - IceGrid

Hi,

Does IceGrid work with Silverlight? I have a Silverlight application and got the SimpleIceGridS server sample running. Is it possible to have the client discover and automatically start the server using the following lines:

HelloPrx hello = null;
try
{
hello = HelloPrxHelper.checkedCast(communicator().stringToProxy("hello"));
}
catch(Ice.NotRegisteredException)
{
IceGrid.QueryPrx query =
IceGrid.QueryPrxHelper.checkedCast (communicator().stringToProxy("DemoIceGrid/Query"));
hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
}
if(hello == null)
{
Console.WriteLine("couldn't find a `::Demo::Hello' object");
return 1;
}

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Yes, Ice for Silverlight can invoke on indirect proxies and similar to Glacier2, the requests on indirect proxies are forwarded to the bridge and the bridge takes care of contacting the locator to resolve the proxy endpoints.

    So you need to set the default locator proxy for the bridge Ice communicator. You can do this for example by setting the Ice.Default.Locator property in the Global.asax file before the communicator is initialized.

    Cheers,
    Benoit.
  • I now have the following in the Application_Start method of the Global.asax file:

    Ice.InitializationData initData = new Ice.InitializationData();
    initData.properties = Ice.Util.createProperties();
    initData.properties.setProperty("Ice.Default.Locator", "DemoIceGrid/Locator:tcp -p 12000");
    Application["com"] = Ice.Util.initialize(initData);


    In my Silverlight application, I'm trying to create the query proxy, so:
    IceGrid.QueryPrx query =
    IceGrid.QueryPrxHelper.checkedCast(_comm.stringToProxy("DemoIceGrid/Query"));

    When I add a reference to IceGridcs.dll, it requires Icecs.dll but adding icecs.dll gives compile errors like the following:

    The type 'Ice.ObjectPrx' exists in both 'c:\Ice-3.2.1\bin\icecs.dll' and 'c:\Program Files\ICE\IceSL-0.1.0\bin\icesl.dll' C:\DotNet\Silverlight\TestApp\TestAppClient\generated\Hello.cs 224 37 helloC

    What I am doing wrong?
  • dwayne
    dwayne St. John's, Newfoundland
    You cannot use the regular C# icegridcs.dll with your Silverlight application.

    If you want to use the IceGrid types in your Silverlight application then you first have to compile the appropriate Slice file(s) using the Slice-to-Silverlight compiler (slice2sl.exe). For example

    slice2sl.exe --ice -ISLICE_DIR SLICE_DIR\IceGrid\Query.ice

    where SLICE_DIR is the location of the Ice slice files.

    Then you would add the generated file, Query.cs, to your application so that it can then have access to the Query interface types.

    Regards,
    Dwayne
  • Works now. Thanks very much for your help.
  • Would you recommend using IceGrid with Silverlight? The demo application from the binary distribution uses direct proxies - does it give better performance over IceGrid?
  • benoit
    benoit Rennes, France
    Hi,

    Using an indirect proxy instead of a direct proxy won't provide any performance gains. IceGrid can help to provide better performances by transparently spreading the load from Silverlight clients to multiple servers. IceGrid is also useful to deploy and manage the back-end servers -- if you have many servers for your Silverlight clients, it's probably a good idea to use it. See the Ice manual for more information on IceGrid.

    Cheers,
    Benoit.