This project is read-only.

How to self-host WCF

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.
Use the following methods to self-host your WCF service in any .NET application:
  1. Create a method to start the service, as shown in the following code example
// Host the service within the application.
public static void Main()
    // Create a ServiceHost for the CalculatorService type.
    using (ServiceHost serviceHost = 
           new ServiceHost(typeof(Service1)))
        // Open the ServiceHost to create listeners         // and start listening for messages.

  1. In the self-hosted case, you must specify the base address in your config file.
      <add baseAddress="http://localhost:8000/WCFSecuritySamples/service"/>

Additional Resources

Last edited May 8, 2008 at 4:50 AM by prashantbansode, version 1


No comments yet.