Ranjita Das
Ranjita Das

Reputation: 443

how to save dynamic endpoints in server app.config?

I create dynamic endpoint like this way on server side:

var host = new ServiceHost(typeof(PokerService.PlayerService));
 for(int i = 1; i <= ; i++)
 {
   host.AddServiceEndpoint(typeof(PokerService.IPlayerService), 
                                  new NetTcpBinding(),
                                  @"net.tcp://localhost:5054/player/"+i);
 }
 host.Open();

Upvotes: 4

Views: 314

Answers (1)

Jatin Khurana
Jatin Khurana

Reputation: 1175

I don't know what is your mean here for dynamic endpoint but you can host the service endpoint in app.confog by using the below code in app.config. This app.config must be in that project which is the main project.

<system.serviceModel>     
        <services>
          <service name="PokerService.PlayerService">
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:5054/player/" />
              </baseAddresses>
            </host>
            <endpoint address="" binding="netTcpBinding" contract="PokerService.IPlayerService" >
    </endpoint>
          </service>
        </services>
      </system.serviceModel>

Upvotes: 1

Related Questions