If one needs to expose multiple endpoints (e.g., one with basicHttpBinding, and another with netTcpBinding) for a single contract in a heterogeneous environment, on a WAS-hosted service, how does one do it?
Everything I've read about WAS configuration of endpoints indicates that endpoint addresses and host base addresses should be left blank, because WAS is supposed to automatically resolve addresses via the path to the .svc file and the protocol.
However, it seems impossible to define an HTTP endpoint and a TCP endpoint for the same contract without explicating the addresses. Every attempt of mine thus far has netted me the coveted "a binding instance has already been associated to listen uri" error.
Ideas?
Thanks
See if this works for you
http://knowledgebaseworld.blogspot.com/2010/06/domain-name-replaced-with-machine-name.html
I was hainvg same issue of "a binding instance has already been associated to listen uri" which get fixed by adding httpGetUrl along with binding address
As far as I understand, the *.svc file is only viable for HTTP protocols, e.g. you can use it for your basicHttpBinding connection. In that case, you're absolutely right - the service's base address and the endpoint's address attribute are ignored - the service URI is defined by server name, optionally port, the virtual directory where the SVC file resides, and the name and extension of the SVC file itself.
So as long as you don't need multiple different HTTP-like protocols and endpoints, that one SVC file should take care of the HTTP traffic.
However, these options do not apply to non-http protocols, like netTcpBinding. In that case, you need to define an endpoint address (possibly as a relative path off an appropriate base address) in your web.config.
Related
I have a WCF port (which I got from add generated items>>Consume WCF service). I have exactly the same service on another server which I wanted to use. I reused all artifacts of previously consumed service and only made a copy of WCF port on Biztalk Administration side with different service address, then I bind both ports with appropriate virtual ports, and it is working fine. But is there any possibility to dynamically update binding information of WCF ports at run time with respect to input data (means I dont want to make multiple similar virtual ports in visual studio), I just want that if I want to add another service port I don't change my orchestration again and again. I only make physical port on Biztalk Administration Console side and bind it with some virtual port and it starts working....
Please let me know if there is some confusion...in question.
Thanks in advance.
I used Role Links to dynamically send data to different servers. But binding file remains the same. There is no need to add additional binding files for each service and no need to amend BizTalk project again and again. Just configure ports and make additional parties and you are done.
I have an app with a self-hosted WCF service.
My WCF service gets published under the URI "net.tcp://localhost:8004/DocumentService". When I run the service on a remote machine and try to discover the service with the new .NET 4 class DiscoveryClient, the found services all have the URI "net.tcp://localhost:8004/DocumentService" too without any information about the actual machine where the service is hosted.
Obviously this is useless if I want to access the service on the remote machine. But I can't find any reference to the actual remote machine (IP address or server name) in the arguments passed to FindProgressChanged.
Is there a way to get the information about the remote machine or do I have to publish my service with the machine name of the remote machine? Or is DiscoveryClient just broken?
I hope this make sense.
I spent a lot of time investigating this problem. Building base addresses in the code was not acceptable for me, as it implies hardcoding transport scheme and port (the latter, of course, can be stored in a separate config section, but then why not just to use the existing section?). I wanted to have an ability to just configure the base address in config as usual. And it turns out that a base address like <add baseAddress="net.tcp://*:8731/"/> will perfectly work. I think the same is true for programmatic configuration.
when I setup the wcf service on a web server, I set the end point address as
<endpoint address="http://www.mydomin.com/clientname/happy.svc"
binding="basicHttpBinding"
name="happysvcbasic"
contract="happysvc.Ihappysvc">
</endpoint>
but when type in above address on a browser, I get a different host name, which is the internal server name, such as,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
svcutil.exe http://internalservername.domain/clientname/happy.svc?wsdl
I tried to add the host/baseaddress tag, but make no difference, what I missed? thanks for help.
When you host via IIS your service in IIS the address is always relative. Assuming you want to achieve something with your endpoint remove the http://
<endpoint address="clientname"
And then your endpoint would be
http://localhost/virtualdirectory/happy.svc/clientname
The use for this is when you are exposing multiple endpoints, as each endpoint has to have a unique address.
See or This for more information.
If you are trying to setup a different dns address for your service you need to change the way you have hosted your website and use host headers.
When you host your WCF service in IIS, you do not get to choose the address, so setting an address= in your <endpoint> is absolutely useless, as is setting base addresses.
When hosting in IIS, the only things that determine your WCF service address are:
the IIS server machine name/IP address, plus possibly a port number
the virtual directory and possibly any subdirectories where your happy.svc file is located
the name of your *.svc file itself, including the .svc extension
So your WCF service address will be something like:
http://yourserver:80/VirtualDirectory/SubDirectory/happy.svc
That's all there is, and you can't change that (at least not now, in WCF 3.5 - it might be different in WCF in .NET 4).
So now: what is your question, really?
I have endpoints defined in a config file with a "fake" domain name. The idea being that this would make deployment easier, since instead of modifying the config files, we simply set the ip address of the "fake" domain name on the enviroments' hosts files. So for example, on my local dev box, I would have an entry in the hosts file
127.0.0.1 fake.domain
and on a user acceptance environment I might have
192.45.34.31 fake.domain
but in my config file I would just have the endpoint
<endpoint address="http://fake.domain/someServiceBase/SomeService.svc" ... />
However, WCF seems to completely ignore the hosts file. I can copy past the address into a browser, and it will come right up, but the WCF client (which is on the local dev box) will give a "host not found" error.
Why does WCF ignore the hosts file?
Edit:
Additional note, everything works if I replace the endpoint address to use the actual ip address directly in the config file, e.g.
<endpoint address="http://127.0.0.1/someServiceBase/SomeService.svc" ... />
Why does WCF ignore the hosts file?
Hmm, I suspect that it isn't. I'd guess that your client is making a connection, but being redirected by the service.
There's an article here that goes into great detail on endpoints:
The Windows Communication Foundation channel infrastructure revolves around the physical address since it’s responsible for receiving incoming messages using a particular transport protocol at a specific location. The Windows Communication Foundation dispatcher, on the other hand, is shielded from such networking details and instead focuses on mapping the incoming message to an endpoint, and ultimately to a method call.
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.