Service-hosted WCF behind the load balancer - wcf

I have 3 servers and a load balancer. Servers names are:
server-11
server-12
server-13
And the balancer's name is:
server-01
Everything works in the intranet, in my local network.
I have IIS-hosted websites at servers, and I access them like that: http://server-01:12321 for example, and it forwards me to some of the server.
Now I need to set up an existing WCF service with WSHttpBinding the same way - install it at all 3 servers (already done) and access it via load balancer. The problem is: my WCF-service is not hosted in IIS, it is hosted in windows service.
Another problem is: I want to have an url for that WCF-service like http://myservice, so when I open it, it will get me to the http://server-01:80 and then load balancer will forward it to some server.
Is it possible? I believe I should set some DNS record somewhere? And what settings are to be made in the load balancer? And what changes should I make in the WCF-service itself?
Another difficulty is that 80 port is already occupied (with several websites hostnames), so I have to use hostname (http://myservice). To be clear: in IIS I can set a hostname for the website, but how to do this with WCF-service, that is hosted in windows service?

Related

Asp.net core application is not accessible from an external load balanced Azure VM

I have created a VM behind an external load balancer in Azure and I am using IIS as the reverse proxy webserver to host the asp.net core application.
I am able to access the application inside the VM using localhost but not able to access the same from my client machine through the public ip configured for the loadbalancer.
I have configured loadbalancing rules for incoming traffic on port 80 and port 443 for the loadbalancer and specified appropriate NSGs for those ports.
Before deploying the asp.net core application I was able to access the defaultwebsite from my client machine. so I assume that inbound rules are taken in to account and working fine.
This is a self contained application and since I am able to access the application inside the VM through localhost I assume that the aspnet hosting module and other configuration required is proper.
Please let me know if there is anything else I can be missing.
I guess i have figured out what the issue is.
The Loadbalancer probe for the application is configured to be Http since its a webserver and is instructed to check at the default path "/" and since the application i have created does not serve anything on "/" its considering the node as unhealthy and does not respond or serve anything.
I changed the probe to tcp and it works just fine.
Thanks,
Teja

Fiddler not capturing WCF service details in load balancer scenario

I have some wcf services (say customerservice) hosted in 2 virtual machines VM1 and VM2. They are load balanced using f5 load balancer. Lets call it LB.
The services are consumed from the Web layer using http://LB/customerservice/customerservice.svc. The load balancer routes to either VM1 or VM2 based on its internal logic. I have fiddler running in both VM1 and VM2 but they do not capture anything.
Any idea what might be happening ? Do we need to do anything special for such load balancer scenario.
Pl suggest.
If you want Fiddler to capture the traffic LB sends to your VM1/2 web servicesyou have to configure Fiddler as reverse proxy -http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy.
Then Fiddler will get the incoming traffic and will forward it to the actual services. If you don't want to change the service configuration then you'd better set Fiddler to run at a different port than the services. In that case, however, you will have to change the LB configuration so that it sends traffic to Fiddler port.

Browsing two sites on the same IIS server

I uploaded two websites on a single IIS local server. One that hosts a WFC service other that consumes it
I know that using host header to distinguish them in not an option without a DNS server, so I gave the first one an all assigned IP ad the second one 172.20.1.44, whenever I try to browse to it locally it gives me the connection timed out
how could I browse to the second site on my local machine to test it
Put them on different ports. Put one site on * 80 and the other on * 8080. You can modify the port in the binding screen of IIS.

Hosting WCF Service on a local machine - DNS work?

I've a WCF service running just on my laptop. The laptop is connected to the web, IP is static.
What's involved in getting that service consumable by a web user (say I'm in Cyprus and my clients are other in the US), can I restrict users by their IP address?
Please not, I'm aware of WCF support for P2P, but that's not what I'm looking for. The service will be migrated to a proper hosting environment after a while.
I'd let IIS do the heavy work and restrict IPs.
Restrict IP addresses in IIS
Just host the WCF inside a web project and use a dynamic DNS service to pass through to your laptop.
HTH

How can you load balance an IIS 6 hosted WCF Service?

We use BigIP to load balance between our two IIS servers. We recently deployed a WCF service hosted on by IIS 6 onto these two Windows Server 2003R2 servers.
Each server is configured with two host headers: one for the load balancer address, and then a second host header that points only to that server. That way we can reference a specific server in the load balanced group for debugging.
So when we run We immediately got the error:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
I did some research and we can implement a filter to tell it to ignore the one of the hosts, but then we cannot access the server from that address.
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://domain.com:80"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
What is the best solution in this scenario which would allow us to hit a WCF service via http://domain.com/service.svc and http://server1.domain.com/service.svc?
If we should create our own ServiceFactory as some sites suggest, does anyone have any sample code on this?
Any help is much appreciated.
EDIT: We will need to be able to access the WCF service from either of the two addresses, if at all possible.
Thank you.
On your bigIP Create 2 new virtual servers
http://server1.domain.com/
http://server2.domain.com/
create a pool for each VS with only the specific server in it - so there will be no actual load balancing and access it that way. If you are short on external IP'S you can still use the same IP as your production domain name and just use an irule to direct traffic to the appropriate pool
Hope this helps
The URL it uses is based on the bindings in IIS. Does the website have more than one binding? If it does, or is the WCF service used by multiple sites? If it is, then you are SOL AFAIK. We ran into this issue. Basically, there can be only one IIS binding for HTTP, otherwise it bombs.
Also, here's info on implementing a ServiceHostFactory. That WILL work if it's possible that your WCF service only be accessible through 1 address (unfortunately for us, this was not possible).
When you need to test a specific machine, you could "bypass" the load balancing and ensure the correct host-header is sent to keeep WCF happy by editing the "hosts" file on the machine you're testing from so, for example:
10.0.0.11 through 10.0.0.16 are the six hosts that are in the cluster "cluster.mycompany.local", with a load balanced IP address of 10.0.0.10. When testing you could add a line to the machines hosts file that says "10.0.0.13 cluster.mycompany.local" to be able to hit the third machine in the cluster directly.