user1312242
user1312242

Reputation: 337

Hosting WCF locally

Can I host a WCF Service using netTcpBinding which is accessible (please note i am asking about ACCESSIBLE means browsable) in the same machine (localhost) and not outside the localhost... not even intranet.

Upvotes: 0

Views: 837

Answers (4)

user1312242
user1312242

Reputation: 337

As suggested by, Henk Holterman

NetNamedPipeBinding is the best approach when we host the service inside a loaalhost and the service requires just intra process communication like communication with another WCF in the same machine or say a .Net client present in the same machine...

Again, netNamedPipeBinding makes the communication faster because

1) Serialization takes place in binary format 2) unlike netTcpBinding where we communicate through a Port, netNamedPipebinding uses named pipes to communicate between process.

Thanks. Suraj

Upvotes: 0

Sir Hally
Sir Hally

Reputation: 2358

You can host WCF services by using IIS (only 7.0 or higher for net.tcp) or as windows service.

For IIS you should create site or web application and add binding with port for net.tcp protocol.

There is no difference between hosting on the localhost and on a remote computer.

In general, it is better to use NetNamedPipeBinding for local connection

Upvotes: 1

Alex
Alex

Reputation: 23290

This can also be done at hosting level (in IIS):

  • open IIS manager
  • select WCF service application folder
  • open "IP Address and Domain Restrictions"
    • if it's not there, you have to add the "ip and domain restrictions" role to the server
  • in "ip address and domain restrictions" enter an allow entry for 127.0.0.1
  • then under "edit feature settings" set "access for unspecified" to Denied

Doesn't matter how the service is setup, IIS won't allow access outside 127.0.0.1

EDIT: This feature is not available on IIS 5.1 (Windows XP). You're going to need a firewall, or check out IIS Express.

Upvotes: 2

allonym
allonym

Reputation: 1418

I should think so, as long as the port it's running on is not externally accessible (e.g. blocked by a firewall).

Upvotes: 3

Related Questions