multithreading - Does a Self-Hosted Windows Forms WCF Service need to be on a background thread? -


i've searched , searched , seen questions similar, not specific, this.

i doing msmq-based request/response wcf setup, windows forms client sends msmq wcf message service, runs long running process, , uses string addressed passed client put status updates in queue on client. client should self-host wcf msmq based service picks , responds status messages.

the problem is, opening host in program.cs , waiting close until formclose, that, @ startup, windows form process 1 message in queue (leftover previous run), , no more. feels kind of threading issue. however, examples i've seen seem act it's okay host.open() in form create or startup, , host.close() on shutdown, , should pick messages fine.

if has example of doing wcf incoming msmq messages picked whenever arrive, while ui stays repsonsive, please let me know.

for it's worth, make sure service , queue configured correctly, did simple wcf standalone library project same config , source files, , processes messages in queue fine. it's trying self-host in winforms app not working properly.

[servicebehavior(instancecontextmode = instancecontextmode.single)] public partial class frmstart : form, iexportstatus {      private void frmstart_load(object sender, eventargs e)     {         if (host == null || host.state != communicationstate.opened)         {              host = new servicehost(this);             // servicehostglobal.addserviceendpoint(typeof(iexportstatus), binding, endpointaddress);             // open servicehostbase create listeners , start listening order status messages.             host.open();          }      } 


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -