Archived

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

Problem with Silverlight and IceGrid deployment

Hi,

I'm having problem with having my Silverlight client locate the IceGrid server. It all worked fine locally, but when I deployed the Silverlight pages to IIS, i get error
Ice.ProtocolException
   reason = "invalid http response code: 12030"

Here are the configuration:

Grid:
IceGrid.InstanceName=DemoIceGrid

#
# The IceGrid locator proxy.
#
Ice.Default.Locator=DemoIceGrid/Locator:tcp -p 12000 -h 10.93.206.77 

#
# IceGrid registry configuration.
#
IceGrid.Registry.Client.Endpoints=tcp -p 12000 -h 10.93.206.77 
IceGrid.Registry.Server.Endpoints=tcp -h 10.93.206.77
IceGrid.Registry.Internal.Endpoints=tcp -h 10.93.206.77
IceGrid.Registry.Data=C:/Documents and Settings/Local Service/Local Settings/Application Data/ZeroC/icegrid/registry

IceGrid.Registry.DynamicRegistration=1

IceGrid.Registry.PermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.AdminPermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.SSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
#
# IceGrid node configuration.
#
IceGrid.Node.CollocateRegistry=1
IceGrid.Node.Name=localhost
IceGrid.Node.Endpoints=tcp
IceGrid.Node.Data=C:/Documents and Settings/Local Service/Local Settings/Application Data/ZeroC/icegrid/node
IceGrid.Node.CollocateRegistry=1
#IceGrid.Node.Output=db
#IceGrid.Node.RedirectErrToOut=1

#
# Trace properties.
#
IceGrid.Node.Trace.Activator=1
IceGrid.Node.Trace.Patch=1
#IceGrid.Node.Trace.Adapter=2
#IceGrid.Node.Trace.Server=3

#
# Dummy username and password for icegridadmin.
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar

Server:
#
# The server creates one single object adapter with the name
# "Hello". The following line sets the endpoints for this
# adapter.
#
Ice.ServerId=SimpleServer
Ice.ProgramName=SimpleServer
#Object adapter Hello
Hello.Endpoints=tcp
Hello.AdapterId=Hello
Hello.RegisterProcess=1
Ice.Default.Locator=DemoIceGrid/Locator:tcp -h 10.93.206.77 -p 4061


#
# Warn about connection exceptions.
#
#Ice.Warn.Connections=1

#
# We want a faster ACM for this demo.
#
Ice.ACM.Server=10

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
#Ice.Trace.Network=1

#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1

#
# Security Tracing
#
# 0 = no security tracing
# 1 = trace messages
#
#IceSSL.Trace.Security=1

#
# SSL plugin configuration
#
Ice.Plugin.IceSSL=icesslcs, Version=3.2.1.0, Culture=neutral, PublicKeyToken=1f998c50fec78381:IceSSL.PluginFactory
IceSSL.DefaultDir=../../../certs
IceSSL.ImportCert.CurrentUser.Root=cacert.pem
IceSSL.CertFile=s_rsa1024.pfx
IceSSL.Password=password
Ice.ThreadPerConnection=1

Server program:
public override int run(string[] args)
    {
        Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
        Ice.Properties properties = communicator().getProperties();
        Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
        adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
        adapter.activate();
        communicator().waitForShutdown();
        return 0;
    }


Client - Global.asax
void Application_Start(Object sender, EventArgs e)
{  
    Ice.InitializationData initData = new Ice.InitializationData();
    initData.properties = Ice.Util.createProperties();
    //Ice.Properties prop = Ice.Util.createProperties();
    initData.properties.setProperty("Ice.Default.Locator", "DemoIceGrid/Locator:tcp -p 12000 -h 10.93.206.77");
    //initData.properties.load("ice.config");
    Application["com"] = Ice.Util.initialize(initData);

    //Application["com"] = Ice.Util.initialize();
}

and in the Page.xaml.cs, I create the proxy object as follows:
Ice.InitializationData initData = new Ice.InitializationData();
                initData.properties = Ice.Util.createProperties();
                initData.properties.setProperty("Ice.BridgeUri", "http://10.93.206.77/IceBridge/IceBridge.ashx");
                _comm = Ice.Util.initialize(initData);

                try
                {
                    _hello = Demo.HelloPrxHelper.uncheckedCast(_comm.stringToProxy("hello"));
                   
                    // _hello = Demo.HelloPrxHelper.uncheckedCast(_comm.stringToProxy("hello:tcp -p 10000"));
                    // _helloOneway = Demo.HelloPrxHelper.uncheckedCast(_hello.ice_oneway());
                }
                catch (Ice.NotRegisteredException)
                {             
                    IceGrid.QueryPrx query =
                        IceGrid.QueryPrxHelper.checkedCast(_comm.stringToProxy("DemoIceGrid/Query"));
                    _hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));

                    
                }



Can you tell me what I am doing wrong?

Comments

  • The line in the Server config should read
    Ice.Default.Locator=DemoIceGrid/Locator:tcp -p 12000 -h 10.93.206.77.

    Still doesn't work on IIS.
  • matthew
    matthew NL, Canada
    In general, it is more convenient if you package up any sample code along with all configuration files, and project files (ie: as a self-contained, compilable example) in an archive and attach to the post, rather than post multiple code segments.

    In this case, however, I suspect that you have not correctly configured the bridge. You must set Ice.Default.Locator on the bridge, not on the SL client, since it is the bridge that talks with IceGrid (the locator), not the client itself.

    To fix this look at Global.asax:
    void Application_Start(Object sender, EventArgs e)
    {
        //Ice.InitializationData initData = new Ice.InitializationData();
        //initData.properties = Ice.Util.createProperties();
        //initData.properties.load("ice.config");
        //Application["com"] = Ice.Util.initialize(initData);
        Application["com"] = Ice.Util.initialize();
    }
    

    Change the code to load ice.config. Then in ice.config set Ice.Default.Locator to the correct location. Alternatively, you could set the locator manually.
    void Application_Start(Object sender, EventArgs e)
    {
        Ice.InitializationData initData = new Ice.InitializationData();
        initData.properties = Ice.Util.createProperties();
        initData.properties.setProperty("Ice.Default.Locator", "DemoIceGrid/Locator:tcp -p 12000 -h 10.93.206.77");
        Application["com"] = Ice.Util.initialize(initData);
    }
    
  • I already have the configuration in the Global.asax to point to the Default Locator.

    To configure the Bridge on IIS, I have followed the instructions in Issue 27, but I run into the following error when accessing IceBridge.ashx

    Compiler Error Message: CS0117: 'Ice.InputStream' does not contain a definition for 'readBlob'.

    I am hosting the bridge on IIS5.1, placed the Global.asax in the same directory as the IceBridge.ashx, with a bin folder for icecs.dll.
  • matthew
    matthew NL, Canada
    It seems that you are not using the icecs.dll that was distributed with the Silverlight distribution. From the INSTALL.txt:

    In order to use Ice for Silverlight it is necessary to also install
    Ice for C#. Specifically it is necessary to install a patched version
    of the Ice for C# 3.2.1 icecs.dll. You can either download a
    precompiled patched DLL or compile the Ice for C# sources yourself
    after applying the patch to the Ice for C# source distribution.

    The Ice for C# source distribution can be downloaded here:

    http://www.zeroc.com/download.html

    The precompiled DLL and the source patch can be downloaded here:

    http://www.zeroc.com/labs/download.html

    Once downloaded or compiled the DLL must be installed in the GAC:

    gacutil -i icecs.dll
  • I am now using the icecs.dll that comes with the Silverlight distribution. However, running IceBridge.ashx gives the following exception in the event log:

    Bridging Error: Ice.UnmarshalOutOfBoundsException
    reason = (null)
    at IceInternal.BasicStream.readBlob(Int32 sz)
    at Ice.InputStreamI.readBlob(Int32 sz)
    at IceBridge.Bridge.ProcessRequest(HttpContext context) in c:\Web Applications\IceBridge\IceBridge.ashx:line 110
    Caused by: System.InvalidOperationException: buffer underflow
    at IceInternal.ByteBuffer.checkUnderflow(Int32 size)
    at IceInternal.ByteBuffer.get(Byte[] b, Int32 offset, Int32 length)
    at IceInternal.ByteBuffer.get(Byte[] b)
    at IceInternal.BasicStream.readBlob(Int32 sz).

    Are there any additional configuration not mentioned in Issue 27 that I could be missing in the bridge configuration? - MIME type, permissions ?

    Running the Silverlight app still returns Ice exception
    Ice.ProtocolException
    reason = "invalid http response code: 12030"
  • matthew
    matthew NL, Canada
    The reported readBlob exception is failing when trying to unmarshal the Ice magic number, which is the start of the request payload. This means that the message payload is not received at all by the bridge application. Most likely the problem is that you are missing the necessary MIME types for the request octet data. The transferred Ice request data is MIME content type "application/binary". The 12030 received by the Ice for SL client is caused by the above failure. Once this failure is rectified then that should go away.

    We have only tested Ice for SL with IIS 7.0, so I am not exactly sure what is necessary to get IIS 5.1 to work in this situation. Is there any way you could use IIS 7, or the Mono ASP.NET web server for your tests?
  • Unfortunately, I only have IIS5.1 and IIS6 to test against.

    What would be the extension for MIME type application/binary?
  • matthew
    matthew NL, Canada
    I'm sorry, but I'm not exactly sure how to configure IIS 5.1/6.0. You can download a free version of the mono ASP.NET web server to test against at Main Page - Mono.

    If your organization is interested in commercially licensing Ice we can investigate IIS 5.1/6 support further. If interested, please contact us at sales@zeroc.com.
  • matthew
    matthew NL, Canada
    The most likely cause of this problem is that you have not enabled PUT on the bridge (IceBridge.ashx). If you do not enable PUT then all calls on the bridge will be rejected with permission denied.
  • I have configured the app to add PUT to the list of verbs for the .ashx extension.

    Pls find attached the IIS configuration for the web app that contains the bridge.

    Thanks for helping.
  • I have also tried Mod Mono for win32 (Apache 2.0.59 and Mono 1.2.6) using the windows patch from
    mod_mono-win32 - mod_mono port for Apache 2 (and 2.2) under windows

    i cannot get the Mod Mono server to run. Do you know whether this should run fine on win32?
  • xdm
    xdm La Coruña, Spain
    Hi Jennifer.

    I have been testing IceSl with IIS-5.5 and is working fine for me.

    I have attached the screens of my IIS configuration for the IceSl hello demo.

    Also from your error i think that there is a problem with file rigths, not sure :) .
    The files need the correct right acces for IIS can serve it, Make sure that the IIS user can read and execute IceBridge.ashx & Global.asax

    IIS use by default the account IISUSR_(MachineName) for annonymous access. If your machine name
    is SIUX the name of IIS user will be IISUSR_SIUX.

    have you enabled logs on IIS and view if there is any HTTP error in the Windows Event Viewer.

    Also if all fails you can add same trace in the IceBridge.ashx and view where the error cames.

    Use this for log to the Event viewer form IceBridge.ashx
     _log.WriteEntry("foo");
    

    Hope this help