Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Implementing WCF Service Behaviors

, 22 Aug 2012 CPOL
Here we will try to implement different service behaviors to increase service performance
InstanceContextModeSample-noexe.zip
InstanceContextModeSample
InstanceContextModeClient
bin
Debug
obj
x86
Debug
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
InstanceContextModeClient.Properties.Resources.resources
Properties
Settings.settings
InstanceContextModeSample.suo
InstanceContextModeSample
bin
Debug
obj
Debug
Properties
VisitorCounterService.csproj.user
ServiceInstanceServer
bin
Debug
ServiceInstanceServer.vshost.exe.manifest
obj
x86
Debug
Properties
InstanceContextModeSample.zip
InstanceContextModeClient.exe
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
InstanceContextModeClient.exe
InstanceContextModeClient.Properties.Resources.resources
Settings.settings
InstanceContextModeSample.suo
InstanceContextModeSample.dll
InstanceContextModeSample.dll
VisitorCounterService.csproj.user
InstanceContextModeSample.dll
ServiceInstanceServer.exe
ServiceInstanceServer.vshost.exe
ServiceInstanceServer.vshost.exe.manifest
ServiceInstanceServer.exe
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using InstanceContextModeService;
namespace ServiceInstanceServer
{
    class Program
    {
        private static ServiceHost host = null;
        static void Main(string[] args)
        {
            host = new ServiceHost(typeof(InstanceContextModeService.VisitorCount));
            host.Opened += new EventHandler(host_Opened);
            host.Closed += new EventHandler(host_Closed);
            host.Open();
            Console.ReadKey();
            host.Close();
            Console.ReadKey();
        }

        static void host_Closed(object sender, EventArgs e)
        {
            Console.WriteLine("Service Closed");
        }

        static void host_Opened(object sender, EventArgs e)
        {
            Console.WriteLine("Service Started");
        }
    }
}

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)

Share

About the Author

Vinod Viswanath
Engineer GE Oil & Gas
India India
Vinod is Microsoft Certified Professional in WebDev 4, And Lead Engineer by profession. He has more than 8+ yrs of experience in IT industry working on Microsoft Technologies. Prefer to be judged not on his job title but by ability to do a good job of what he is supposed to do.
 
Technical experience most specifically C#,Ado.Net,Asp.Net, WCF, Sql Server,JavaScript,XML,Web services.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411023.1 | Last Updated 22 Aug 2012
Article Copyright 2012 by Vinod Viswanath
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid