简体   繁体   中英

how to work with Self hosted WCF service

I have successfully hosted the WCF service in windows forms application. Now what I need is a way when my service is used by any client i want to show in the form where the service is hosted that last accessed date and time from the client machine and client id.

So when ever my client is using any operation on my service is also sending me its date and time as well everything is working fine but unable to display it on the form in a label.

Can somebody suggest me please.

Thanks

My suggestion would to use the logging and tracing that comes with WCF, you will have to write custom code to read the client logged information

Please see links that might help you

http://msdn.microsoft.com/en-us/library/ms730918.aspx

http://msdn.microsoft.com/en-us/library/aa751795.aspx

I suggest using the Microsoft Message Queue (MSMQ), which plays nicely together with WCF . MSMQ is lightwheight to use and fast, and the best of it, it is built-in into Windows and supported out-of-the-box into .NET Framework. You can decide to send messages transactional and persisted or have them priorised, if you wish.

The WCF service would send a message with your needed information each time an operation is called that you want to log in your WinForms application.

The Forms application would then receive the message asynchronously and write onto your screen or logfile or wherever you need.

Reading and writing from/ to the MSMQ in C# is straightforward.

Here is a good starting point: Tom Hollander's blog

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM