tags:

views:

101

answers:

1

I have created a WCF service that needs to be hosted in a Window Service because it is participating in a P2P mesh (NetPeerTcpBinding). When I tried to host the WCF Service with NetPeerTcpBinding endpoints in the IIS Service container the service wouldn't run because it turns out that the P2P binding doesn't work in IIS.

I have exposed a HTTP endpoint from the WCF service hosted in a Windows Service container and I want to know if there is a way to create an ISA Web Farm that will route traffic to http endpoints on two machines each running the same WCF service in a Windows Service container.

A: 

I figured this out quit a wile ago, sorry it took so long to get the answer posted.

Create a separate service contract called IDefaultDocumentService with one method on it that is decorated with both OperationContract and WebGet.

<OperationContract(), WebGet()> 
Function GetDefaultDocument() As System.ServiceModel.Channels.Message

Now implement that contact in a very simple DefaultDocumentService class

Public Class DefaultDocumentService
    Implements IDefaultDocumentService

    Public Function GetDefaultDoc() As Message Implements IDefaultDocumentService.GetDefaultDocument
        Return Message.CreateMessage(MessageVersion.None, "", "Hello!")
    End Function
End Class

In the config file for you windows service hook up a separate service for the DefaultDocumentService and map it to the root directory of your other WCF service. When you are putting these services into a Web Farm on ISA it will hit your default document service and get a "Hello!" message which is enough for the ISA server to know that the service is alive.

<system.serviceModel>
  <services>
    <service name="YourMainService">
      <endpoint address="http://localhost:10000/YourMainService.svc"
                binding="wsHttpBinding"
                contract="IYourMainService" />
    </service>

    <service name="DefaultDocumentService">
      <endpoint address="http://localhost:10000/"
                binding="webHttpBinding"
                behaviorConfiguration="DefaultDocumentEndpointBehavior"
                contract="IDefaultDocumentService" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <behavior name="DefaultDocumentEndpointBehavior">
        <webHttp/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>
Ryan Pedersen