English 中文(简体)
ISA Web Farm and WCF service hosted in a Windows Service with basicHttpBinding
原标题:
  • 时间:2010-03-23 22:01:16
  •  标签:
  • wcf
  • web-farm

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.

最佳回答

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>
问题回答

暂无回答




相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签