views:

119

answers:

1

Hi.

I am using CSLA.NET. It works realy nice with the wsHttpBinding. Now, I have my own Windows-Service and search the solution, that I can use this Windows-Service as the CSLA-Server and using nettcpbinding. Can someone give me a tip how to going on? Perhaps someone has a sample how I can do that.

Thank you!

Best Regards, Thomas

A: 

Basically, you need to do two things:

  • change your server-side configuration to include an endpoint with the netTcpBinding (this can be in addition to the existing wsHttpBinding endpoint - no problem)

  • add the netTcpBinding to your client's config file as well and selecting that endpoint when you connect

You should have something like this in your server side config:

<services> 
   <service name="YourService">
      <endpoint name="something"
                address=""
                binding="wsHttpBinding"
                contract="IYourService" />
   </service>
</services>

Just add an endpoint for the netTcpBinding:

<services> 
   <service name="YourService">
      <endpoint name="something"
                address=""
                binding="wsHttpBinding"
                contract="IYourService" />
      <endpoint name="something"
                address="net.tcp://YourServer:7171/YourService"
                binding="netTcpBinding"
                contract="IYourService" />
   </service>
</services>

Now if you're hosting in IIS, you might run into some problems - you need to configure IIS7 (Win2008 or Win2008R2 server), and in IIS6, you won't be able to host your netTcp service in IIS6 :-(

Same thing on the client side - add a second endpoint for netTcp:

<client>
    <endpoint name="something"
              address="http://YourServer/SomeVirtDir/YourServiceFile.svc"
              binding="wsHttpBinding"
              contract="IYourService" />
    <endpoint name="netTcpEndpoint"
              address="net.tcp://YourServer:7171/YourService"
              binding="netTcpBinding"
              contract="IYourService" />
</client>

and now when you create your endpoint in code, use the named endpoint:

YourServiceClient client = new YourServiceClient("netTcpEndpoint");

That should be all, really (unless CSLA requires something extra which I wouldn't know about.... I know "plain-vanilla" WCF)

marc_s