c# - MSMQ binding mismatch -


we have setup used work , has stopped sometime on past few months. use custom dead-letter queue specified in config gets set this::

msmqintegrationbinding msmq = new msmqintegrationbinding(     // defaults windowsdomain.  want messages authenticated.     msmqintegrationsecuritymode.transport);  msmq.deadletterqueue = deadletterqueue.custom; msmq.customdeadletterqueue = new uri("net.msmq://localhost/private/bulkupdatesdeadletter"); 

we've started getting error, seems pretty clear:

system.invalidoperationexception: mismatch occurred between binding , msmq configuration. messages cannot sent. custom dead letter queue specified in binding must transactional queue. ensure custom dead letter queue address correct , queue transactional queue.

we've verified both pointing correct queue in config , queue transactional. there other issues might cause exception thrown, or missing in obvious?

update: had our web ops team delete , recreate queues , still receiving error.

the following code provided microsoft corporation in article bindingssection.cs source code in c# .net

  namespace system.servicemodel.configuration      {         using system.configuration;          using system.servicemodel.channels;          using system.servicemodel;         using system.collections.generic;          using system.globalization;         using system.reflection;         using system.xml;         using system.security;           public sealed partial class bindingssection : configurationsection, iconfigurationcontextproviderinternal          {              static configuration configuration = null;             configurationpropertycollection properties;               public bindingssection() { }              dictionary<string, bindingcollectionelement=""> bindingcollectionelements              {                                 {                      dictionary<string, bindingcollectionelement=""> bindingcollectionelements = new dictionary<string, bindingcollectionelement="">();                      foreach (configurationproperty property in this.properties)                     {                         bindingcollectionelements.add(property.name, this[property.name]);                     }                       return bindingcollectionelements;                  }              }              new public bindingcollectionelement this[string binding]             {                                 {                      return (bindingcollectionelement)base[binding];                 }              }               protected override configurationpropertycollection properties              {                                 {                     if (this.properties == null)                      {                         this.properties = new configurationpropertycollection();                      }                       this.updatebindingsections();                      return this.properties;                 }             }              [configurationproperty(configurationstrings.basichttpbindingcollectionelementname, options = configurationpropertyoptions.none)]             public basichttpbindingcollectionelement basichttpbinding              {                  { return (basichttpbindingcollectionelement)base[configurationstrings.basichttpbindingcollectionelementname]; }             }               // property should called/set bindingssectiongroup tryadd             static configuration configuration             {                  { return bindingssection.configuration; }                 set { bindingssection.configuration = value; }              }               [configurationproperty(configurationstrings.custombindingcollectionelementname, options = configurationpropertyoptions.none)]              public custombindingcollectionelement custombinding             {                 { return (custombindingcollectionelement)base[configurationstrings.custombindingcollectionelementname]; }             }               [configurationproperty(configurationstrings.msmqintegrationbindingcollectionelementname, options = configurationpropertyoptions.none)]              public msmqintegrationbindingcollectionelement msmqintegrationbinding              {                 { return (msmqintegrationbindingcollectionelement)base[configurationstrings.msmqintegrationbindingcollectionelementname]; }              }              [configurationproperty(configurationstrings.netpeertcpbindingcollectionelementname, options = configurationpropertyoptions.none)]             public netpeertcpbindingcollectionelement netpeertcpbinding              {                 { return (netpeertcpbindingcollectionelement)base[configurationstrings.netpeertcpbindingcollectionelementname]; }              }               [configurationproperty(configurationstrings.netmsmqbindingcollectionelementname, options = configurationpropertyoptions.none)]              public netmsmqbindingcollectionelement netmsmqbinding             {                 { return (netmsmqbindingcollectionelement)base[configurationstrings.netmsmqbindingcollectionelementname]; }             }               [configurationproperty(configurationstrings.netnamedpipebindingcollectionelementname, options = configurationpropertyoptions.none)]              public netnamedpipebindingcollectionelement netnamedpipebinding              {                 { return (netnamedpipebindingcollectionelement)base[configurationstrings.netnamedpipebindingcollectionelementname]; }              }              [configurationproperty(configurationstrings.nettcpbindingcollectionelementname, options = configurationpropertyoptions.none)]             public nettcpbindingcollectionelement nettcpbinding              {                 { return (nettcpbindingcollectionelement)base[configurationstrings.nettcpbindingcollectionelementname]; }              }               [configurationproperty(configurationstrings.wsfederationhttpbindingcollectionelementname, options = configurationpropertyoptions.none)]              public wsfederationhttpbindingcollectionelement wsfederationhttpbinding             {                 { return (wsfederationhttpbindingcollectionelement)base[configurationstrings.wsfederationhttpbindingcollectionelementname]; }             }               [configurationproperty(configurationstrings.ws2007federationhttpbindingcollectionelementname, options = configurationpropertyoptions.none)]              public ws2007federationhttpbindingcollectionelement ws2007federationhttpbinding              {                 { return (ws2007federationhttpbindingcollectionelement)base[configurationstrings.ws2007federationhttpbindingcollectionelementname]; }              }              [configurationproperty(configurationstrings.wshttpbindingcollectionelementname, options = configurationpropertyoptions.none)]             public wshttpbindingcollectionelement wshttpbinding              {                 { return (wshttpbindingcollectionelement)base[configurationstrings.wshttpbindingcollectionelementname]; }              }               [configurationproperty(configurationstrings.ws2007httpbindingcollectionelementname, options = configurationpropertyoptions.none)]              public ws2007httpbindingcollectionelement ws2007httpbinding             {                 { return (ws2007httpbindingcollectionelement)base[configurationstrings.ws2007httpbindingcollectionelementname]; }             }               [configurationproperty(configurationstrings.wsdualhttpbindingcollectionelementname, options = configurationpropertyoptions.none)]              public wsdualhttpbindingcollectionelement wsdualhttpbinding              {                 { return (wsdualhttpbindingcollectionelement)base[configurationstrings.wsdualhttpbindingcollectionelementname]; }              }              public static bindingssection getsection(configuration config)             {                  if (config == null)                 {                      throw diagnosticutility.exceptionutility.throwhelperargumentnull("config");                  }                  return (bindingssection)config.getsection(configurationstrings.bindingssectiongrouppath);             }              public list<bindingcollectionelement> bindingcollections              {                                 {                      list<bindingcollectionelement> bindingcollections = new list<bindingcollectionelement>();                     foreach (configurationproperty property in this.properties)                      {                         bindingcollections.add(this[property.name]);                     }                      return bindingcollections;                 }              }               internal static bool tryadd(string name, binding binding, configuration config, out string bindingsectionname)              {                 bool retval = false;                 bindingssection.configuration = config;                 try                 {                     retval = bindingssection.tryadd(name, binding, out bindingsectionname);                  }                                  {                      bindingssection.configuration = null;                 }                 return retval;             }               internal static bool tryadd(string name, binding binding, out string bindingsectionname)              {                  // tryadd built on assumption bindingssectiongroup.configuration valid.                 // should protected @ callers site.  if assumption invalid,                  // configuration system in indeterminate state.  need stop in manner                 // user code can not capture.                 if (null == bindingssection.configuration)                 {                      diagnosticutility.debugassert("the tryadd(string name, binding binding, configuration config, out string binding) variant of function should called first. configuration object not set.");                     diagnosticutility.failfast("the tryadd(string name, binding binding, configuration config, out string binding) variant of function should called first. configuration object not set.");                  }                   bool retval = false;                  string outbindingsectionname = null;                 bindingssection sectiongroup = bindingssection.getsection(bindingssection.configuration);                 sectiongroup.updatebindingsections();                 foreach (string sectionname in sectiongroup.bindingcollectionelements.keys)                  {                     bindingcollectionelement bindingcollectionelement = sectiongroup.bindingcollectionelements[sectionname];                       // save custom bindings last choice                     if (!(bindingcollectionelement custombindingcollectionelement))                      {                         methodinfo tryaddmethod = bindingcollectionelement.gettype().getmethod("tryadd", bindingflags.instance | bindingflags.nonpublic);                         if (tryaddmethod != null)                         {                              retval = (bool)tryaddmethod.invoke(bindingcollectionelement, new object[] { name, binding, bindingssection.configuration });                             if (retval)                              {                                  outbindingsectionname = sectionname;                                 break;                              }                         }                     }                 }                  if (!retval)                 {                      // of time, custombinding should come out ok.                      custombindingcollectionelement custombindingsection = custombindingcollectionelement.getbindingcollectionelement();                     retval = custombindingsection.tryadd(name, binding, bindingssection.configuration);                      if (retval)                     {                         outbindingsectionname = configurationstrings.custombindingcollectionelementname;                     }                  }                  // little oddity exists make sure out param assigned before method                  // exits.                 bindingsectionname = outbindingsectionname;                  return retval;             }              /// <securitynote>              /// critical - uses securitycritical method unsafelookupcollection elevates             /// safe - not leak config objects              /// </securitynote>              [securitycritical, securitytreatassafe]             void updatebindingsections()              {                 extensionelementcollection bindingextensions = extensionssection.unsafelookupcollection(configurationstrings.bindingextensions, configurationhelpers.getevaluationcontext(this));                  // extension collections additive (basicmap) , not allow <clear>                  // or <remove> tags, nor allow overriding entry.  allows                 // optimize walk binding extension collection if counts                  // mismatch.                  if (bindingextensions.count != this.properties.count)                 {                      foreach (extensionelement bindingextension in bindingextensions)                     {                         if (null != bindingextension)                         {                              if (!this.properties.contains(bindingextension.name))                             {                                  configurationproperty property = new configurationproperty(bindingextension.name,                                      type.gettype(bindingextension.type, true),                                     null,                                      configurationpropertyoptions.none);                                  this.properties.add(property);                             }                          }                     }                  }              }              /// <securitynote>             /// critical - uses securitycritical method unsafegetassociatedbindingcollectionelement elevates             /// safe - not leak config objects             /// </securitynote>              [securitycritical, securitytreatassafe]             internal static void validatebindingreference(string binding, string bindingconfiguration, contextinformation evaluationcontext, configurationelement configurationelement)              {                  // validatebindingreference built on assumption evaluationcontext valid.                 // should protected @ callers site.  if assumption invalid,                  // configuration system in indeterminate state.  need stop in manner                 // user code can not capture.                 if (null == evaluationcontext)                 {                      diagnosticutility.debugassert("validatebindingreference() should called valid contextinformation");                     diagnosticutility.failfast("validatebindingreference() should called valid contextinformation");                  }                   if (!string.isnullorempty(binding))                  {                     bindingcollectionelement bindingcollectionelement = null;                      if (null != evaluationcontext)                      {                         bindingcollectionelement = configurationhelpers.unsafegetassociatedbindingcollectionelement(evaluationcontext, binding);                      }                      else                     {                          bindingcollectionelement = configurationhelpers.unsafegetbindingcollectionelement(binding);                     }                      if (bindingcollectionelement == null)                      {                         throw diagnosticutility.exceptionutility.throwhelpererror(new configurationerrorsexception(sr.getstring(sr.configinvalidsection,                              configurationhelpers.getbindingssectionpath(binding)),                              configurationelement.elementinformation.source,                             configurationelement.elementinformation.linenumber));                      }                      if (!string.isnullorempty(bindingconfiguration))                     {                          if (!bindingcollectionelement.containskey(bindingconfiguration))                         {                              throw diagnosticutility.exceptionutility.throwhelpererror(new configurationerrorsexception(sr.getstring(sr.configinvalidbindingname,                                  bindingconfiguration,                                 configurationhelpers.getbindingssectionpath(binding),                                  configurationstrings.bindingconfiguration),                                 configurationelement.elementinformation.source,                                 configurationelement.elementinformation.linenumber));                         }                      }                 }              }               contextinformation iconfigurationcontextproviderinternal.getevaluationcontext()              {                 return this.evaluationcontext;             }              /// <securitynote>             ///   requiresreview - return value used security decision -- see comment in interface definition              /// </securitynote>              contextinformation iconfigurationcontextproviderinternal.getoriginalevaluationcontext()             {                  diagnosticutility.debugassert("not implemented: iconfigurationcontextproviderinternal.getoriginalevaluationcontext");                 return null;             }         }      }      </remove></clear></bindingcollectionelement></bindingcollectionelement></bindingcollectionelement></string,></string,></string,> 

Comments