c# - WCF MSMQ fires only once -


i'e written c# wcf service that's supposed handle incoming messages, parse xml contain , transcribe data database table.

when start windows service hosts wcf msmq service implementation, processes 1 message , stops.

this used process messages in queue until started renaming things. i'm @ bit of loss, because invoked - once. no errors logged in event log. window service host continues run, , responds promptly service stop instruction scm.

  <netmsmqbinding>     <binding name="binding.msmq.transportsecurity" maxreceivedmessagesize="32767">       <readerquotas maxbytesperread="32767" maxstringcontentlength="32767" maxarraylength="32767"/>       <security mode="transport">         <transport msmqauthenticationmode="none" msmqencryptionalgorithm="rc4stream"             msmqprotectionlevel="none" msmqsecurehashalgorithm="sha1" />         <message clientcredentialtype="windows" />       </security>     </binding>   </netmsmqbinding> 

...

<services>   <service behaviorconfiguration="behavior.commonsense.chapterwriter"     name="commonsense.chapterwriter">     <endpoint address="net.msmq://localhost/private/bob.logwriter"       binding="netmsmqbinding" bindingconfiguration="binding.msmq.transportsecurity"       name="endpoint.commonsense.chapterwriter.msmq" contract="commonsense.ichapterwriter">       <identity>         <dns value="localhost" />       </identity>     </endpoint>     <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" />     <host>       <baseaddresses>         <add baseaddress="http://localhost/commonsense/chapterwriter/" />       </baseaddresses>     </host>   </service> </services> 

...

using system.servicemodel;  namespace commonsense {   [servicecontract]   public interface ichapterwriter   {     [operationcontract(isoneway = true)]     void write(string xml);   } } 

the problem buffer size

it wasn't running the first time, running once.

the message generator used in test case happens configured such produces 2 large messages , small 1 (16k). small 1 processing , large 1 encountered fatal exception derail wcf service without stopping wait thread of windows service host process.

increasing various buffer sizes resolved problem completely. if see similar behaviour, visit readerquotas settings , binding maxreceivedmessagesize. wcf config editor makes easy.

<netmsmqbinding>    <binding name="binding.msmq.transportsecurity" maxreceivedmessagesize="65535">      <readerquotas        maxbytesperread="65535"        maxstringcontentlength="65535"        maxarraylength="65535"/>      <security mode="transport">        <transport msmqauthenticationmode="none" msmqencryptionalgorithm="rc4stream"            msmqprotectionlevel="none" msmqsecurehashalgorithm="sha1" />        <message clientcredentialtype="windows" />      </security>    </binding>  </netmsmqbinding>  

wcf configuration editor

i cannot recommend tool highly enough. while have pretty idea of how configure wcf, boilerplating without accidental omissions valuable, impossibility of mistyping name when referring it.

this tool was present in tools menu of visual studio, path exe in windows sdk i'm not sure how got onto system, sure google or bing can if don't have it.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -