Code Monkey home page Code Monkey logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
Changed ticket status to "Started".

Original comment by [email protected] on 9 Jul 2008 at 3:35

  • Changed state: Started

from aspnetserve.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
You could use this Windows service library for hosting it: 
http://www.hoytsoft.org/serviceBase.aspx

It takes care of UAC in Vista (and later) for you. For example, to host a WCF 
service, all you need to do is:

public static void Main(string[] args) {
    bool pleaseStop = false;
    ManualResetEvent evt = new ManualResetEvent(false);

    ServiceBase.RunService(args, new SimpleService(
        "WCF_Server",
        "WCF Hosting Service",
        "Hosts a WCF service",
        null,

        /* Start */
        delegate(SimpleService Service, object Param) {
            ServiceHost selfHost = new ServiceHost(typeof(WCFHost), 
serviceURI);
            try {
                selfHost.AddServiceEndpoint(typeof(IWCFHost), new 
WSHttpBinding(SecurityMode.None), "WCFService");
                ServiceMetadataBehavior smb = new 
ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                selfHost.Description.Behaviors.Add(smb);
                selfHost.Open();

                //Wait until we're asked to stop
                while (!pleaseStop) {
                    if (Service.Debug) {
                        Console.WriteLine("Press <ENTER> to 
exit");
                        Console.ReadLine();
                        Service.ServiceTestStop();
                    }
                    evt.WaitOne(10 * 1000, false);
                }

                selfHost.Close();
            } catch (Exception ex) {
                Debug.WriteLine(ex);
            } finally {
                selfHost.Abort();
                evt.Close();
            }
            Console.WriteLine("Stopped");
        },

        /* Stop */
        delegate(SimpleService Service, object Param) {
            Console.WriteLine("Please Stop");
            pleaseStop = true;
            evt.Set();
        }
    ));
}

Original comment by david.g.hoyt on 15 Jul 2008 at 5:19

from aspnetserve.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
I also have an extensive XML configuration library that complements this very 
well. 
It already has support for connection strings, forms authentication, url 
rewriting, 
e-mailing (w/ templating), localization, etc. on a per-machine basis. IOW, you 
can 
create a basic configuration, and then choose to override sections on a 
per-machine 
basis (e.g. the connection string is different on different machines). Plus 
it's 
easy to add new, type-safe settings. Let me know if you're interested. It's 
licensed 
under the CPOL (http://www.codeproject.com/info/cpol10.aspx), so it's very 
liberal 
and shouldn't clash w/ your license.

Original comment by david.g.hoyt on 15 Jul 2008 at 5:29

from aspnetserve.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
I have completed the windows service.

Original comment by [email protected] on 18 Jul 2008 at 3:22

  • Changed state: Fixed

from aspnetserve.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.