Communication Issues with Broker App / EPM IE 11

Add-in Express™ Support Service
That's what is more important than anything else

Communication Issues with Broker App / EPM IE 11
 
Damon Durand




Posts: 8
Joined: 2017-01-27
I'm trying to create an IE BHO. However, my target is IE 11 with Enhanced Protected Mode enabled on Server 2012R2.

The IE BHO needs to be able to read a number of registry keys that controls its operation and write messages back to the Event Log. From my understanding this will require the use of a broker application.

I believe I followed the instructions on how to add the broker application, but obviously I'm missing something.

My code is a bit involved to post here, but I think I've whittled it down to the bare essentials:

In the BHO I have the following code in IEModule_OnConnect:

        
        Dim request As New Hashtable
        request.Add("ACTION", "PING")
        Dim response As New Object
        If Me.SendDataToBroker(request, response) Then
            Dim responseHashTable As Hashtable = CType(response, Hashtable)
            If Not responseHashTable.ContainsKey("RESULTCODE") Then
                MsgBox("Empty Result Code!")
                '==Bad response, no resultcode!
            ElseIf responseHashTable("RESULTCODE") <> 0 Then
                MsgBox("Result code non-zero:" & responseHashTable("RESULTCODE"))
                '==Error occured!
            Else
                MsgBox(responseHashTable("RESULT"))
            End If
        Else
            MsgBox("SendDataToBroker failed!")
        End If


In the Broker application, I have the following in the IEBrokerModule_OnDataReceived:


        '==We have received a request from the add-on
        Dim request As Hashtable = CType(e.RequestData, Hashtable)
        Dim response As Hashtable = New Hashtable

        Select request("ACTION").ToString
            Case "PING"
                response.Add("RESULTCODE", 0)
                response.Add("RESULT", "PONG")
            Case Else
                response.Add("RESULTCODE", -1)
                response.Add("RESULT", "ERROR")
        End Select
        e.ResponseData = response


Other than that the two applications are basically just the output from the Wizards other than I did add in the Broker GUID into the BrokerGUID design property of the main application.

I see the broker application start with IE in task manager, so I believe the GUID is registered properly.

As I have above, I end up with a message box "SendDataToBroker failed!".

If I move the OnConnect code into the OnBrokerStarted event then I do actually receive the "PONG" back from the broker but shortly thereafter the IE process hangs.

I must be missing something obvious? Any help would be greatly appreciated! Thanks!
Posted 27 Jan, 2017 13:55:40 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Damon,

You need to use the OnBrokerStarted event.

Damon Durand writes:
If I move the OnConnect code into the OnBrokerStarted event then I do actually receive the "PONG" back from the broker but shortly thereafter the IE process hangs.


Turn off all other IE add-ons. Try a different HTML page. Is your code involved in the issue? Try to debug it.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Jan, 2017 05:47:29 Top
Damon Durand




Posts: 8
Joined: 2017-01-27
It looks like this was a case of the debug code (messageboxes in this case) causing hiccups with the broker connection. If I remove all the messageboxes from the OnBrokerStarted event and keep the code exactly the same then things operate the way one would expect. (I'm guessing it is dependent on some timeout because if I step through with a debugger in the OnBrokerStarted event and take too much time it seems to fire a second time and open a second tab in IE?)

Considering the included documentation doesn't mention the need to use (or the availability of) the OnBrokerStarted event do you have an updated example/documentation available?
Posted 30 Jan, 2017 13:31:37 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Damon,

We don't have another example. We will modify the documentation.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Jan, 2017 03:28:46 Top