Trying to invoke DirectMethod multiple times is causing an error on Internet Explorer 7

  1. #1

    Trying to invoke DirectMethod multiple times is causing an error on Internet Explorer 7

    Hi,

    First post, so please be gentle. :-)

    I am trying to call a direct method from JavaScript. On success, I just add the data to the store.

    Ext.net.DirectMethods.UC.FetchDataFromRemote(arrayOfObjs[i],
    {
    	success: function (returnList) {
    		myStore.loadData(returnList, true);
    	},
    	failure: function (result, response, control, eventType, action, extraParams, o) {
    		if (response.isAbort) {
    			Ext.Msg.alert("An error occurred", "An error occurred... process was aborted");
    		}
    	},
    
    	timeout: 900000,
    	showFailureWarning: true
    });
    It works well on Firefox, but when I try it on IE 7, I'm getting an error in the UI that says Transaction aborted (-1). If I inspect the error that is returning in the failure, I'm getting this message:

    result	"System.Runtime.InteropServices.COMException (0x80010002): Call was canceled by the message filter. (Exception from HRESULT: 0x80010002 (RPC_E_CALL_CANCELED))
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       at System.Management.ManagementScope.InitializeGuts(Object o)
       at System.Management.ManagementScope.Initialize()
       at System.Management.ManagementScope.Connect()
       at PatchUtility.CompanyX.PatchUtility.Windows.Utilities.ConfigurationUtilities.GetQuickFixEngineeringData(String serverName, Int32 idStart, String userName, String password) in C:\local\develop\visualstudio\CompanyX-patch-utility-app\PatchUtility\CompanyX\PatchUtility\Windows\Utilities\WindowsUtilities.cs:line 64
       at PatchUtility.Search_Form.FetchDataFromRemoteServers(String[] servers) in C:\local\develop\visualstudio\CompanyX-patch-utility-app\PatchUtility\Search_Form.aspx.cs:line 1407"	String
    If I test using one value at a time, each will run successfully. However, when I pass in an array with multiple items, then I get this error. The problem doesn't occur in Firefox.

    Based on other posts, I think it may be a timeout issue, but I have a timeout specified and I also tried:

    Ext.net.DirectEvent.timeout = 120000;
    that was suggested in another post.

    If someone has any suggestions, that would be great.

    Thanks,
    Eric
  2. #2
    Hi Eric,

    Welcome.

    My first guess would be Timeout as well. What is the size of the Response being returned? Can you use a tool such as Firefox + Firebug (or Fiddler) to inspect the response? Maybe the Response is huge and IE7 just cannot deal with the weight.

    Are you able to Debug and inspect the what's happening inside FetchDataFromRemote?

    I created the [DirectMethod] following sample which takes an Array of custom People objects, and that seems to work fine, but obviously it's just a simple sample.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <script runat="server">
        [DirectMethod(Namespace = "App")]
        public void DoSomething(Person[] people)
        {
            StringBuilder sb = new StringBuilder();
            
            foreach (Person person in people)
            {
                sb.AppendFormat("{0}<br />", person.Name);
            }
    
    
            X.Msg.Notify("Message", sb.ToString()).Show();
        }
    
    
        public class Person
        {
            public string Name { get; set; }
        }
    </script>
    
    
    <!DOCTYPE html>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
    <form runat="server">
        <ext:ResourceManager runat="server" />
            
        <ext:Button 
            runat="server" 
            Text="Submit" 
            OnClientClick="App.DoSomething([{ name : 'Bill' }, { name : 'Mary' }, { name : 'Helmut' }])" 
            />
    </form>
    </body>
    </html>
    Geoffrey McGill
    Founder
  3. #3

    Answers

    Quote Originally Posted by geoffrey.mcgill View Post
    My first guess would be Timeout as well. What is the size of the Response being returned? Can you use a tool such as Firefox + Firebug (or Fiddler) to inspect the response? Maybe the Response is huge and IE7 just cannot deal with the weight.

    Are you able to Debug and inspect the what's happening inside FetchDataFromRemote?
    Hi Geoffrey,

    Thanks for the reply.

    I inspected the sizes in Firebug. (I'm still working on getting Fiddler to work with my local dev .NET server.) For the 3 async messages, the size of the JSON responses are: 25K, 26K and 47K. Time-wise, it's about 10 secs, 10 secs and 13 secs.

    Yes, I do have control of the FetchDataFromRemote method. Basically, in the method, I am calling out to Windows WMI to retrieve data about the server (server patches). There is a timeout setting that you can set for the WMI search, but when I set that too low, it just immediately returned with a timeout (even in Firefox).

    For debugging the method itself, I wrapped the WMI call in the DirectMethod with 'Start' and 'Finish' messages. With Firefox, I see all 3 get called and returned in the log file. With IE, I see all 3 get started, but only the 3rd call comes back with data. The other 2 eventually return to the failure callback with the stack trace that I mentioned in the original post. If I change the order of the servers that I'm looking for, whatever the 3rd server is, becomes the data that I get back in IE. So, maybe there is some issue with firing a WMI-type of call within the async directmethod method? I'll keep investigating. Maybe I can try invoking it directly from the Handler rather than via script to see if that will change anything?

    Thanks again.
    Eric
  4. #4
    So, I'm a little unclear... are you making three [DirectMethod] calls, or one? Are you attempting to return three responses from one [DirectMethod] call?

    If an array of three objects is passed to the DirectMethod, then typically one call is made, and one response is returned.

    If you're making three separate calls, it might be better to chain them together. Upon the Successful return of the first, start the second, and so on.

    If you're making one DirectMethod call, passing in an Array of three objects, then looping through those three objects and making three separate calls to WMI, I'm not too sure how the browser would affect those calls. Because this is a browser related issue, I'm assuming this scenario is not what you're doing.

    the size of the JSON responses are: 25K, 26K and 47K. Time-wise, it's about 10 secs, 10 secs and 13 secs
    These are totally reasonable response package sizes, so size shouldn't be the issue.

    What happens if you only use two objects in the Array instead of three?
    Geoffrey McGill
    Founder
  5. #5

    Reply

    Quote Originally Posted by geoffrey.mcgill View Post
    So, I'm a little unclear... are you making three [DirectMethod] calls, or one? Are you attempting to return three responses from one [DirectMethod] call?
    Sorry about that. Yes, I am making 3 DirectMethod calls from the script. It returns 3 separate responses. Basically, for the IE version, I make 3, but only 1 comes back successful. The other 2 fail.

    I will try to chain them and see if that helps.

    Quote Originally Posted by geoffrey.mcgill View Post
    If you're making one DirectMethod call, passing in an Array of three objects, then looping through those three objects and making three separate calls to WMI, I'm not too sure how the browser would affect those calls. Because this is a browser related issue, I'm assuming this scenario is not what you're doing.
    I can try this approach, but I was hoping to execute multiple at once since it will take some time depending on the number selected.

    Quote Originally Posted by geoffrey.mcgill View Post
    What happens if you only use two objects in the Array instead of three?
    I'll have to give that a try as well.

    Thanks,
    Eric
  6. #6

    Reply

    Ok, I tested it under two different scenarios. The first was firing all of the methods at once.

    1) If I run it with one value (server) specified, then I get the results. It doesn't matter which value is specified. I get results with no errors.
    2) If I run it with two or more values specified, then I always get the results of running the query with the last value only. I get the error mention in the original post for all other values.

    Note that this is only on IE. On Firefox, all of the tests work. I also tested it on IE 7 and 8 and it fails on both.

    For the second scenario, I only call the methods one at a time, chaining each one after the other. This also fails, but with a different error:

    2-04-05 09:52:06.6330 PatchUtility.CompanyX.PatchUtility.Windows.Utilities.ConfigurationUtilities GetQuickFixEngineeringData - ManagementException - The following error occurred: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
    System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       at System.Management.ManagementScope.InitializeGuts(Object o)
       at System.Management.ManagementScope.Initialize()
       at System.Management.ManagementScope.Connect()
       at PatchUtility.CompanyX.PatchUtility.Windows.Utilities.ConfigurationUtilities.GetQuickFixEngineeringData(String serverName, Int32 idStart, String userName, String password) in C:\local\develop\visualstudio\CompanyX-patch-utility-app\PatchUtility\CompanyX\PatchUtility\Windows\Utilities\WindowsUtilities.cs:line 66
    So, in this scenario where each is called one-at-a-time, I get that error for the first few values. The final value will make it through. It's similar to the problem where I fire all at once, but I get this different error message.

    I'll also check to see if I can get some help on the WMI side of things to see if there's something I'm doing wrong there.

    Thanks,
    Eric
  7. #7

    D'oh!

    Ok, I found the problem. It was a difference in how the browser was dealing with the values that I was passing in. Basically, I am allowing the user to enter the values as a list separated by newline characters. In the script, I was doing a split on \n. In Firefox, the newline must have been getting stripped off. In IE, the newline was on each of the values. So, of course, that's why it worked for the last value.

    Geoffrey, thanks for all of your help. Sorry that you spent the time on such a trivial issue.

    Regards,
    Eric

Similar Threads

  1. Replies: 1
    Last Post: Jul 04, 2011, 2:10 PM
  2. [CLOSED] internet explorer cannot open the internet site
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 28, 2009, 10:30 AM
  3. Internet Explorer 8
    By Ben in forum Open Discussions
    Replies: 3
    Last Post: Feb 25, 2009, 12:38 AM
  4. Replies: 4
    Last Post: Jan 28, 2009, 12:28 PM
  5. Replies: 10
    Last Post: Dec 15, 2008, 3:13 PM

Tags for this Thread

Posting Permissions