WCF - remote service without using IIS - base address?

I'm trying to get my head around the addressing of WCF services.

We have a client-server setup where the server occasionally (maybe once a day) needs to push data to each client. I want to have a lightweight WCF listener service on each client hosted in an NT service to receive that data. We already have such an NT service setup hosting some local WCF services for other tasks so the overhead of this is minimal.

Because of existing legacy code on the server I believe the service needs to be exposed as ASMX and use basicHttpBinding to allow it to connect.

Each client is registered on the server by the user (they need to configure them individually) so discovery is not the issue.

My question is, how does the addressing work? I imagine the user entering the client's address on the server in the form

http://0.0.0.0/MyService

or even

http://hostname/MyService

If so, how do I configure the client service in its App.config? Do I use localhost?

If not then what is the reccommended way of exposing the service to the server?

Note:

  • I don't want to host in IIS as that adds extra requirements to the hardware required for the client.
  • The clients will be almost certainly located on LANs, not over the public internet

Answers


You configure the base address of the service like so:

<system.serviceModel>
  <services>
    <service name="Ns.FooService">
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:9999" />
        </baseAddresses>
      </host>
      <endpoint
          address="/foo"
          binding="basicHttpBinding"
          contract="Ns.IFooContract" />
     </service>
  </services>
</system.serviceModel>

And then your service could be accessible through http://servename:9999/foo. You may take a look at this article for more information.


Need Your Help

How to plot points outside certain polygon area in MATLAB

matlab plot polygon

I have been looking around for a method to plot points outside a polygon's area(hexagon in my case). Here's the scenario that I want to achieve, I have a small hexagon located inside a big hexagon....

Linux directory permission setting

php linux exec

I'm trying to rename a folder created by another user.