Click here to Skip to main content
15,885,925 members
Articles / Desktop Programming / ATL

TCP Remoting Windows Service Host with Server GC

Rate me:
Please Sign up or sign in to vote.
3.40/5 (3 votes)
14 Apr 2004CPOL4 min read 67.5K   690   20  
Implement Server GC for TCP Remoting Host.
#pragma once

using namespace System;
using namespace System::Collections;
using namespace System::ServiceProcess;
using namespace System::ComponentModel;


namespace CLRMHost
{
	/// <summary> 
	/// Summary for CLRMHostWinService
	/// </summary>
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	public __gc class CLRMHostWinService : public System::ServiceProcess::ServiceBase 
	{
	public:
		CLRMHostWinService()
		{
			InitializeComponent();    
		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		void Dispose(bool disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
		
	protected:
		/// <summary>
		/// Set things in motion so your service can do its work.
		/// </summary>
		void OnStart(String* args[])
		{
			Load();
		}
		
		/// <summary>
		/// Stop this service.
		/// </summary>
		void OnStop()
		{     
			// TODO: Add code here to perform any tear-down necessary to stop your service.
		}
    		
	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container *components;

		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>	
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();
			this->CanStop = true;
			this->CanPauseAndContinue = true;
			this->AutoLog = true;
			this->ServiceName = S"CLRMHostWinService";
		}		

		void Load();
	};
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I am a Microsoft Certified Application Developer (MCAD), currently focusing on using .Net Framework to develop Business Solutions. I am mostly language neutral. I have used C, C++, ATL, MFC, VB.Net, C#, VB 6, PL/SQL, Transact SQL, ASP, Fortran, etc.

Comments and Discussions