Port windows from the host WCF Service to Linux/mono2.8

Source: Internet
Author: User

Windows service is a formal term for these background programs and background services. Windows Services can be run in the background without user intervention, without any interface. Use the Windows Service Manager for management. The Service Manager can only do some simple operations: start, pause, continue, stop. Windows service features: it runs in the background without user interaction and can be started with Windows startup.

The background service is called daemon on Unix/Linux and contains many daemon in Linux. The simplest way to judge daemon is to look at the name. All automatically started services in Linux are in the/etc/rc. d/init. d/directory, such as MySQL. If you do not want a service to run automatically, set/etc/rc. d/init. d/The service script in the directory can be removed (do you have to remove it? You cannot use a manual startup like window ?).

Operational Status:

  • Start is equivalent to the start command in the service script.
  • The Stop command is equivalent to the script Stop command of the Deputy Foreign Minister.
  • Restart closes the service and restarts, which is equivalent to the script restart command.
  • Reload enables the server to re-read the configuration file without restarting, which is equivalent to the reload command of the Service script.
  • Status provides the current status of the service, which is equivalent to the status command of the Service script.
  • Condrestart: if the service is locked, the service is shut down and then started again. This is equivalent to the condrestart command.

The Windows service under Mono is called MONO-service. Mono-service runs. NET 1.0 assembly and. NET 2.0 or above assembly with mono-service2. Mono 2.8 does not support. Net 1 programs, so we are now using mono-service2, command line instructions for reference to http://manpages.ubuntu.com/manpages/lucid/man1/mono-service.1.html.

-D: Directory
Use this option to specify the working directory for
Service. The default is the current directory.

-L: lockfile
Specifies the file to use for locking, the default is a filename
Constructed in/tmp Based on the name of the program that hosts
The service.

-M: Message
Name to show in the syslog.

-N: Name
Use this to specify the service to be launched (if the program
Contains more than one service). The default is to run
First defined service.

-- Debug
Use this option to prevent mono-service from redirecting stdin
And stdout and prevent the program to be sent to the background.
Equivalent to -- no-daemon

-- No-daemon
Use this option to prevent mono-service from redirecting stdin
And stdout and prevent the program to be sent to the background.
Equivalent to -- debug.

Mono 2.8 has better support for WCF. The example here is to port a WCF Service of self host in Windows to Linux.

1. Compile a WCF server in window as the window service. The code structure of our service is as follows:

To port the. NET program to mono, we usually use the net application to migrate to the mono tool (MOMA) to check the compatibility. Check the result of the following project to see if mono2.8 supports WCF perfectly.

Dynipservicews is the host of the WCF Windows service. We put the code in the monodevelop compiling directory in Linux and put it in the/home/geffzhang/projects/dynipservicews directory. Switch to this directory and execute the command.

mono-service DynIPServiceWS.exe
When dynipclient.exe is run, the running result is returned, indicating that the service is already running. If the target machine actively rejects the request, the service is not started.
mono DynIPClient.exe。
For mono WCF can refer to this blog, the author wrote a series of articles: http://veritas-vos-liberabit.com/monogatari/
Download the example in this article: http://cid-33478a966734670f.office.live.com/self.aspx/.Public/WCF/DynIPUpdater%5E_0.1.zip
 
At present, there is another problem that has not been solved, that is, how to package mono-service into a Linux daemon for future Supplements. What should we do if we are welcome to share it with others? Http://www.cnblogs.com/sjhrun2001/archive/2009/03/10/1408264.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.