locked
WCF Windows Services Binding ? RRS feed

  • Question

  • What binding type should I use to create a WCF Windows Service ?

    .NETVinodh

    Monday, July 23, 2012 12:53 PM

Answers

  • I think this is the basic template provided by microsoft, it generates a wshttpbinding.

    You are right HTTP is for WEB ... however, wcf provides different hosting options.

    IIS, Windows Activation Server (WAS), Windows Service, Self host are the options to host your services.

    So you can still create a Service with different bindings and host it in your required hosting environment.

    If you are only aiming Windows Service, then you should consider Nettcpbinding. You can still create other binding in your service.

    If you have both nettcp and http bindings you can host it in WAS (which is part of IIS Architecture) and combine the power of Windows Service and traditional web service (hosted in IIS)... this gives you more flexibility.

    At the end of the day, it really depends on what your requirement... the framework is there for extentibility ...


    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    • Marked as answer by LeoTang Tuesday, July 31, 2012 9:49 AM
    Tuesday, July 24, 2012 7:29 AM

All replies

  • wsHttpBinding can be used to achieve this. Please find more information here
    <host>
              <baseAddresses>
                <add baseAddress="http://YourMachineName:8000/YourService"/>
              </baseAddresses>
            </host>
            <endpoint address=""
                      binding="wsHttpBinding"
                      contract="IYourService" />

    If this post answers your question, please click Mark As Answer. If this post is helpful please click Mark as Helpful.

    Regards,
    Nair S



    • Edited by Nair S Monday, July 23, 2012 2:49 PM code
    Monday, July 23, 2012 2:47 PM
  • Agree with Dragan. Just to add, if you are not consuming the service via Web Application and you only consume it via windows application or windows Service (Service to service), then nettcpbinding is the most efficient one.

    But you can expose the same service with different binding ... so you can have multiple binding with separate endpoint for the same service. So you can have any combination of the binding as you need.


    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    Tuesday, July 24, 2012 5:38 AM
  • When I created a simple WCF service library , I found wsHttpBinding and mexHttpBinding bindings inside the app.config. Why so? why not other bindings ? 

    Also I found the base address is a http url inside app.config , If I am creating a WCF windows service, why should the base address is of type http? . If  I am not wrong base address with http is for Web services , and not for Windows services . 


    .NETVinodh

    Tuesday, July 24, 2012 6:23 AM
  • I think this is the basic template provided by microsoft, it generates a wshttpbinding.

    You are right HTTP is for WEB ... however, wcf provides different hosting options.

    IIS, Windows Activation Server (WAS), Windows Service, Self host are the options to host your services.

    So you can still create a Service with different bindings and host it in your required hosting environment.

    If you are only aiming Windows Service, then you should consider Nettcpbinding. You can still create other binding in your service.

    If you have both nettcp and http bindings you can host it in WAS (which is part of IIS Architecture) and combine the power of Windows Service and traditional web service (hosted in IIS)... this gives you more flexibility.

    At the end of the day, it really depends on what your requirement... the framework is there for extentibility ...


    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    • Marked as answer by LeoTang Tuesday, July 31, 2012 9:49 AM
    Tuesday, July 24, 2012 7:29 AM