When you write self-hosted Indigo application, you need to define your endpoints yourself. You can do this through your code; however, every time you decide to change your binding or add new endpoint, you'll have to recompile your application. Or you can do it through your config file.

Here's a sample self-hosted Indigo application. To keep the post shorter, I skipped over the service contract and the service implementation.

ServiceHost<TestService> testService = null;
testService = new ServiceHost<TestService>();
testService.BaseAddresses.Add(new Uri("
testService.BaseAddresses.Add(new Uri("net.tcp://localhost/TestService"));

Note that I add two base addresses for my service host. This is not necessary to get your endpoints to work, so forget about these for now. Here's how to define your endpoint in the config file:

<?xml version="1.0" encoding="utf-8"?>
      <service serviceType="TestService">
        <endpoint address="http://localhost/Test/Service" bindingSectionName="basicProfileBinding" contractType="ITestService" />

This will add one endpoint to your service listening at http://localhost/Test/Service using the BP 1.0 binding. If you want to add different bindings, you can add more endpoints:

<endpoint address="WSProfile" bindingSectionName="wsProfileBinding" contractType="ITestService" />
<endpoint address="TCPTransport" bindingSectionName="netProfileTcpBinding" contractType="ITestService" />

Now your service will listen on multiple endpoints with different bindings for each of them.

Notice that for the last two endpoints, I didn't specify full address. Instead, I specified relative address. Indigo will match the transport defined by the endpoint binding to the base addresses I added in the code that use the same protocol scheme. Thus, the WSProfile endpoint will listen at http://locahost/TestService/WSProfile address and the TCPTransport endpoint will listen at net.tcp://localhost/TestService/TCPTransport address.

That's enough for this post. Go ahead and experiment with your endpoint config. And in the next post I'll show you how to configure your service behavior through config.