WCF Self-Hosted Windows Service HTTPS Multiple Domains Same IP:Port - wcf

So I want to have multiple WCF Self-Hosted Windows services listen on 443 over HTTPS, different IP addresses.
My base URL is something like:
red.contoso.com:443/api
blue.contoso.com:443/api
However, when I try to register red.contoso.com:443/api it takes the entire namespace!!
Is there no way to instruct WCF to NOT try to register the entire https://+:443 namespace, but only red.contoso.com:443 (or the IP for red.contoso.com -- e.g. xxx.xxx.xxx.xxx:443) so that I can have the other service listen on blue.contoso.com:443 (or the IP for blue.contoso.com -- e.g. yyy.yyy.yyy.yyy:443)?
Can WCF self-hosted not support this scenario?

Related

net.tcp wcf service (windows service hosted) in domain server and client outside of domain

I have a wcf service (with net.tcp binding) hosted at windows service and a wpf client. when I run the service in a server outside the company's domain it works excellent, the problem is when I host the service in a server inside the company's domain, and try to run the wpf app in a client outside of the company domain.
I'm getting the same error, "The Socket connection was aborted..."
I try with Security Mode None, Transport and the same result.
My question is, what is the correct way to do that? I mean host the wcf net TCP service in a domain server and call it from a client outside of domain?
Thanks a lot!
I change the binding from net.tcp to wshttp and the service works fine!
Server with the corporate domain and client without corporate domain
The thing is I need the make this work with net.tcp
Neither a Windows Domain nor DNS have anything to do with WCF/TCP if you don't explicitly make it so.
Assuming the address you gave actually leads to the PC you host your service on (so no local IP addresses) and nothing in between (like a firewall) blocks the connection, it should work.
The correct way is to make sure client and server can talk to each other. If it's different networks, you will need NAT and if one is a corporate network I'd be very surprised to see no firewall that you need to configure.
As a first step, try to ping your target machine from your client machine.

What port should use HTTP transport based WCF service?

What port should use WCF HTTP transport based service? I created WCF service and Visual Studio assigned address http://localhost:7517/
But some customers can use web proxies and it seems that using standard 80 or 8080 is good idea, isn't it? How to force WCF client to use proxy to get to WCF service? From other side we should be confident that port 80 is not occupied by some web server. Is it correct to require from customer isolating WCF service on separate server to avoid collision? What is the best practice?
UPDATED: 80 port is bad candidate: system (Microsoft-HTTPAPI/2.0 for example) uses it often: Why is System process listening on Port 80?

WCF: how to consume a self host service from internet?

I have a self host service in a WPF application and a client. It works fine if the client and the service are in the same LAN, so I can send messages from client to the service.
However, I would like to know how I can consume the service from internet.
I open the TCP ports for the listing port and the mex in my router in the NAT section and I have disabled my firewall of windows (I am working in a virtual windows xp).
I am trying to use net.tcp binding, is my first option, but also I am trying with wsHttpBinding and the problem is the same, I can send message in the LAN but I can't from internet.
Perhaps it's because I don't know how to configure the address in the service or in the client, or something like that.
Thanks you very much.
Daimroc.
EDIT1: if I use the www.canyouseeme.org the can access to my service. If I stop my service then i get an error. So it looks like that the service is visible. Then why can't send messages from the client?
Since you're on a LAN, it is very likely that the machine that is hosting the WCF service is not assigned an IP address accessible from the Internet. For example, if the machine has an IP address starting with 10... or 172... or 192... then that is an internally assigned IP address.
Your machine must be set up to use an IP address assigned by a registrar and optionally, assigned a domain name (e.g. canyouseeme.org) so the Internet DNS servers can translate it to the assigned IP address.

How can a WCF service listen the same port as IIS?

I could run a Windows Service hosted WCF service listening http://localhost:80/MyService while IIS was serving pages on http://localhost:80 and both works.
But many places in the internet (like this and this) say that only a single process can listen each port simultaneoulsy.
Are they wrong?
HTTP.sys makes this possible. From the article:
...because WCF and IIS 6.0 both use the kernel-mode HTTP stack (HTTP.sys), IIS 6.0 can share port 80 with other self-hosted WCF services running on the same machine...
HTTP.sys acts as a port-forwarding service, for HTTP (port 80) traffic.
Could it be that you are hosting the WCF service in IIS. So that IIS is sending the request to the WCF service based on the URL.
Edit:
It may be also that the WCF services were setup to do port sharing like this:
http://msdn.microsoft.com/en-us/library/ms734772.aspx
Edit2:
Ok, I reread your edited question, see the links in this answer:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8993f7c5-1f78-4156-a131-d9b40af10d9a
"The IP Listen List allows WCF services to coexist with applications that use a port for some of the IP addresses of the machine. If the IP Listen List contains any entries, the HTTP Server API will only bind to those IP addresses that the list specifies."

How to host WCF services locally instead of http binding..?

How to host WCF services locally instead of http binding.. I mean the services should be hosted within the .NET environment and not by using http or netTCP.. Could you please help me with the configuration for the same?
What are you trying to achieve here that can't be performed by using http or tcp settings for the local machine for both ends of the WCF contract? WCF isn't just between machines, you can also set it to communicate between different processes on the same machine.
I think you are confusing between hosting a WCF service and a WCF binding. A WCF service can be hosted in many different applications such as standalone executables, windows services, a web server such as IIS, ...
Once you've found an appropriate host for the service you have to decide what binding to use. A binding is used to specify the transport, encoding, and protocol details required for clients and services to communicate with each other.
Note that choosing a host could further limit the choice of bindings available. For example if you decide to host your service in IIS you could only use HTTP/S as transport and NetTcp is not available (in IIS7 it is available through WAS).
How to confgiure NetNamedPipeBinding.
How to: Host a WCF Service in a Managed Windows Service.