Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Strange Issue:Window Service

Strange Issue:Window Service

Scheduled Pinned Locked Moved C#
helpdata-structuresquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ramdil
    wrote on last edited by
    #1

    Hi All I am facing a strange issue and i am working on this issue for last one week,but i am not able to find it.I have a window service which reads the MSMQ .This windows service will do only this function.Now, when some thing is written to MSMQ, window service will read the msmq.Now there is nothing in queue ,then also it will loop and if some thing comes inside the msmq then again it will read ...this works fine if i am doing in regular intervals. Now if am not doing any operations for two or three hours ,then status of windows service will be started but it will not reading the msmq,and it is not throwing any error..also...this is the strange thing i am facing..why it is behaving like this.Can any one help me in this idea.I am pasting the start section of of mywindows service here .can any one tell me what is wrong in this code.Thanks in advance this code i am calling inside a thread.. try { MessageQueue mq = null; System.Messaging.Message msg = null; while(true) { //MessageQueue mq = null; //System.Messaging.Message msg = null; try { if(mq == null) { mq = new System.Messaging.MessageQueue (XMLReprocessMSMQPath); } RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,"Read Queue", LoggingMessageTargets.Both); msg = mq.Receive(new TimeSpan(0,0,0,10,0)); RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,"Data Rec", LoggingMessageTargets.Both); msg.Formatter = new ActiveXMessageFormatter(); XMLReprocessMSMQFileName=ReceiveMessage(msg.Body.ToString()); SendXMLToWebervice(XMLReprocessMSMQFileName); } catch (System.Messaging.MessageQueueException ex) { if(ex.ErrorCode != -2147467259) // Ignore timeout error { RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,ex.ToString(), LoggingMessageTargets.Both); mq.Close(); mq.Dispose(); mq = null; MessageQueue.ClearConnectionCache(); Thread.Sleep(10000); } else { mq = null; } } catch (Exception ex) { RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,ex.ToString(), LoggingMessageTargets.Both); mq.Close(); mq.Dispose(); mq = null; MessageQueue.ClearConnectionCache(); } } } catch(Exception ex) { RemoteLoggingManager.LogMessage(LoggingMessageTypes.Informatio

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups