none
Possible to use Self-Host for remote calls? RRS feed

  • Question

  • This might be a stupid question but is it possible to set up a wcf self-host service on one computer and access it with another with a net.tcp endpoint? If so, how is that done?

    If it's not possible. What is the easiest way (also resulting in a small footprint) to host a wcf service accessible to remote clients?

    Thanks for help!
    Tuesday, October 13, 2009 2:58 PM

Answers

  • Hi,
    of course.
    you can make it.
    1. first,you should make a self-host  WCF service.
    2.exposed a  service endpoint with  net.tcp  binding.remeber open the port on firewall you are defined for the Service endpoint.
    3.Create a test client to call the service.
       run the client on another server. you can test.

    I can give you sample for Self hosted WCF Service using netTcpBinding. you can take as a reference.
    it has 3 project, WCF service class library,Host App,Client.
    /Files/frank_xl/WCFServiceMEXFrankXuLei.rar

    I did test WCF upload file.
    host app runing in one server
    client runs on another server.
    it works well.
    you need to updated the service and client endpoint configaration file due to your case. such as ,change the localhost to your server IP address.



    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:32 AM
    Wednesday, October 14, 2009 2:52 AM
  • Check this sample- http://msdn.microsoft.com/en-us/library/ms752250.aspx

    it uses self hosting and net tcp transport and uses console service and client. You can always deploy the client and server/ service on different machines and give it a run.


    Thanks,
    -Phani
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:32 AM
    Wednesday, October 14, 2009 5:59 AM
  • As help for someone else I found the following MSDN-page with an example of how to configure a Self-host service and a cross-machine client:

    http://msdn.microsoft.com/en-us/library/ms734784.aspx

    I found the link from the following post:

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/1551b4e1-8e15-4da2-b155-d398379809b3

    Thanks
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:34 AM
    Wednesday, October 14, 2009 10:34 AM

All replies

  • Sure it can be done. Take a look at this article , it should help.

    Regards,
    Stipe-Ivan
    Tuesday, October 13, 2009 3:07 PM
  • Thanks for the reply.

    The article you pointed out were quite general about self-hosting and it didn't say how to make a self-hosted service available for a remote client.

    Do you have more information on how this can be done? For example: how should I configure the endpoint addresses for the self-host so that a remote client can find it?

    Thanks again.
    Tuesday, October 13, 2009 7:06 PM
  • Hi,
    of course.
    you can make it.
    1. first,you should make a self-host  WCF service.
    2.exposed a  service endpoint with  net.tcp  binding.remeber open the port on firewall you are defined for the Service endpoint.
    3.Create a test client to call the service.
       run the client on another server. you can test.

    I can give you sample for Self hosted WCF Service using netTcpBinding. you can take as a reference.
    it has 3 project, WCF service class library,Host App,Client.
    /Files/frank_xl/WCFServiceMEXFrankXuLei.rar

    I did test WCF upload file.
    host app runing in one server
    client runs on another server.
    it works well.
    you need to updated the service and client endpoint configaration file due to your case. such as ,change the localhost to your server IP address.



    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:32 AM
    Wednesday, October 14, 2009 2:52 AM
  • Check this sample- http://msdn.microsoft.com/en-us/library/ms752250.aspx

    it uses self hosting and net tcp transport and uses console service and client. You can always deploy the client and server/ service on different machines and give it a run.


    Thanks,
    -Phani
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:32 AM
    Wednesday, October 14, 2009 5:59 AM
  • As help for someone else I found the following MSDN-page with an example of how to configure a Self-host service and a cross-machine client:

    http://msdn.microsoft.com/en-us/library/ms734784.aspx

    I found the link from the following post:

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/1551b4e1-8e15-4da2-b155-d398379809b3

    Thanks
    • Marked as answer by xkrja Wednesday, October 14, 2009 10:34 AM
    Wednesday, October 14, 2009 10:34 AM