locked
BRE not calling .Net class RRS feed

  • Question

  • H,

    I have a custom class to get a property that is used in an orchestration, however in our prod environment it's not getting called.   It looks like the BRE is getting called and when testing using the BRE composer it exceutes as expected.  The same set-up also works on our other enviroments.   Any ideas?  Many thanks in advance

    [Serializable]

        public class BREHelper
        {
            private string SendLocationString;

            public string SendLocation
            {
                get
                {
                    EventLog.WriteEntry("NBCU.BizTalk.PlanningGrid", "Get: " + SendLocationString, EventLogEntryType.Information);
                    return SendLocationString;
                }
                set
                {
                    SendLocationString = value;
                    EventLog.WriteEntry("NBCU.BizTalk.PlanningGrid", "Set: " + SendLocationString, EventLogEntryType.Information);
                }
            }
        }

    


    GilesB

    Friday, January 23, 2015 4:59 PM

Answers

  • Few things I would try,

    1-     1- Static Support- You have already checked this.

    2-      2-Make sure policy/vocab – are deployed and published in production env

    3-      3- Make sure the class is GAC’ed on all the BizTalk servers

    4-      4-Are you using exception handling in BizTalk orch? It would help to catch any exception before or after call Rules

    5-      5-If possible you can debug your Orch

    6-      6-In your code of custom class, Following section is there

    EventLog.WriteEntry("NBCU.BizTalk.PlanningGrid", "Get: " + SendLocationString, EventLogEntryType.Information);

    Did you check if those event source has been created on production servers? “NBCU.BizTalk.PlanningGrid

    7-     7- Rule Engine Update service is running / restarted properly.

    Ch

          Check event log entry for any warnings or errors on all your BizTalk servers (mainly where your orchestration processing host is running).

    Th  there should be something.

    C


    Greetings,HTH
    Naushad Alam

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
    alamnaushad.wordpress.com


    • Edited by Naushad.AlamModerator Monday, January 26, 2015 4:39 PM added event log entry
    • Marked as answer by Angie Xu Monday, February 2, 2015 2:25 AM
    Monday, January 26, 2015 4:35 PM
    Moderator

All replies

  • By far, the most likely reason is Static Support is not enabled on that computer.

    https://msdn.microsoft.com/en-us/library/dd298814.aspx

    About half way down, there is a registry entry to change.

    Friday, January 23, 2015 6:16 PM
    Moderator
  • Hi,

     Enable invoking static methods without requiring an object instance by setting the value of the following registry key to 1 or 2:

    HKLM\SOFTWARE\Microsoft\BusinessRules\3.0\StaticSupport (DWORD)

    For value 2.

    An object instance is not required. The static method is called at the policy translation time if all parameters are constant. This is a performance optimization because the static method is called only once, even though it is used in multiple rules in conditions. Static methods that are used as actions will not be executed at the translation time, but static methods used as parameters can be executed.

    Thanks

    Abhishek

    Saturday, January 24, 2015 12:28 PM
  • Thanks, I thought it could be that at first too however I don't have that setting on the 2 QA servers or my Dev boxes and it works as expected, it just seems to be when running it through the 2 prod servers.  FYI... I'm using BTS 2010.  Many thanks in advance!

    Calling BRE:

    Reg entries from:




    GilesB

    Monday, January 26, 2015 11:20 AM
  • Had to post in 2 parts because of image limit :|  Thanks again!

    Dev Reg:

    Prod Reg:


    GilesB

    Monday, January 26, 2015 11:21 AM
  • Hi GilesB,

    Can you check BTSNTSvc.exe.config or BTNTsvc[64].exe.config file for static support entry in your QA and DEV boxes?

    You will find a config entry like below:

    <configuration>    
       <configSections>        
          <section name="Microsoft.RuleEngine" type="System.Configuration.SingleTagSectionHandler" />
       </configSections>    
       <Microsoft.RuleEngine 
       StaticSupport="1"    
       />
    </configuration> 

    The problem is that, by default, the BRE will not execute the static method, unless a specific registry setting is set.

    Since you are using 64bit machine, then you can add StaticSupport registry key using either of the following options:

    • You need to look under HKLM\Software\Wow6432Node\Microsoft\BusinessRules\3.0. If this key exists, then you can add StaticSupport here.
    • Another option is to put StaticSupport in the BTNTsvc[64].exe.config file, also add this configuration in the configuration file of the Business Rule Composer (located in : C:\Program Files (x86)\Common Files\Microsoft BizTalk\Microsoft.RuleComposer.exe.config)

    Hope this helps.

    Rachit


    Please mark as answer or vote as helpful if my reply does

    Monday, January 26, 2015 12:41 PM
    Moderator
  • Thanks Rachit, however the class isn't static.  Thanks.

    GilesB

    Monday, January 26, 2015 1:15 PM
  • Rachit Sikroria is correct, you can also set the StaticSupport option using the .config file.  The Registry setting is more common (at least that I've seen) and is what I would recommend.

    To clarify the meaning of that setting, the class itself does not have to be static, only the member.  In C#, any static member is callable on a non-static class.

    However, since it looks like you are passing an instance of BREHelper (it's cut off in the pic), there's something else going on.

    Are you sure you have the exact same Assemblies deployed to each machine, versions included?

    Monday, January 26, 2015 1:30 PM
    Moderator
  • Thanks Johns, that's interesting to know about any static member is callable on a non-static class.

    I've checked the assemblies in the GAC's and used a reflector against them and they are the same ones that are working in QA and dev.

    Thanks


    GilesB

    Monday, January 26, 2015 1:37 PM
  • Hi,  FYI I also have 'StaticSupport' enabled in the BTNTsvc64.exe.config and Microsoft.RuleComposer.exe.config on both prod servers.  Thanks

    <Microsoft.RuleEngine
     UpdateServiceHost="localhost"
     UpdateServicePort="3132"
     UpdateServiceName="RemoteUpdateService"
     CacheEntries="32"
     CacheTimeout="3600"
     PollingInterval="60"
     TranslationTimeout="3600"
     CachePruneInterval="60"
     DatabaseServer="UKROMDBWP008,4070"
     DatabaseName="BizTalkRuleEngineDb"
     SqlTimeout="-1"
     StaticSupport="1"
        />



    GilesB

    Monday, January 26, 2015 1:50 PM
  • Then you need to enable Tracking on the Policy and see what the BRE is doing internally on the PROD machine(s).
    Monday, January 26, 2015 2:02 PM
    Moderator
  • Hi,  FYI I also have 'StaticSupport' enabled in the BTNTsvc64.exe.config and Microsoft.RuleComposer.exe.config on both prod servers.  Thanks

    <Microsoft.RuleEngine
     UpdateServiceHost="localhost"
     UpdateServicePort="3132"
     UpdateServiceName="RemoteUpdateService"
     CacheEntries="32"
     CacheTimeout="3600"
     PollingInterval="60"
     TranslationTimeout="3600"
     CachePruneInterval="60"
     DatabaseServer="UKROMDBWP008,4070"
     DatabaseName="BizTalkRuleEngineDb"
     SqlTimeout="-1"
     StaticSupport="1"
        />



    GilesB

    I think there could be some issue in assembly deployment in GAC. Can you try again. No harm!

    Post that do restart the Rules Engine Update Service and Host instance too.

    Rachit


    Please mark as answer or vote as helpful if my reply does

    Monday, January 26, 2015 2:32 PM
    Moderator
  • Few things I would try,

    1-     1- Static Support- You have already checked this.

    2-      2-Make sure policy/vocab – are deployed and published in production env

    3-      3- Make sure the class is GAC’ed on all the BizTalk servers

    4-      4-Are you using exception handling in BizTalk orch? It would help to catch any exception before or after call Rules

    5-      5-If possible you can debug your Orch

    6-      6-In your code of custom class, Following section is there

    EventLog.WriteEntry("NBCU.BizTalk.PlanningGrid", "Get: " + SendLocationString, EventLogEntryType.Information);

    Did you check if those event source has been created on production servers? “NBCU.BizTalk.PlanningGrid

    7-     7- Rule Engine Update service is running / restarted properly.

    Ch

          Check event log entry for any warnings or errors on all your BizTalk servers (mainly where your orchestration processing host is running).

    Th  there should be something.

    C


    Greetings,HTH
    Naushad Alam

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
    alamnaushad.wordpress.com


    • Edited by Naushad.AlamModerator Monday, January 26, 2015 4:39 PM added event log entry
    • Marked as answer by Angie Xu Monday, February 2, 2015 2:25 AM
    Monday, January 26, 2015 4:35 PM
    Moderator
  • HI Did you get any resolution for this ? I am facing same issue 
    Saturday, June 25, 2016 1:11 PM
  • issue is resolved by changing static Support in Reg edit
    Tuesday, December 13, 2016 7:09 PM