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?
Related
Error:
Could not find default endpoint element that references contract 'ServiceReference1.IService1' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Can someone help me please with regards to the endpoint configuration?
When the service was running on the local machine the client was pointing at the following:
<endpoint name="BasicHttpBinding_IService1"
address="http://localhost:54651/Service1.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1"
contract="ServiceReference1.IService1" />
What do we need to write when the service is running on the web hosting service?
It looks like you're hosting it in IIS Express on your local/dev machine.
Are you also using IISExpress or IIS? Verify if the service on the remote machine can be accessed at http://localhost:54651/Service1.svc. Your port number might be different or the address may have to be changed completely when you installed it. Change the address in the configuration file to wherever the service actually is and it should work.
If it was working on your local machine - my guess is you made a classic edit error. The http://localhost:54651/Service1.svc" service address in your config file needs to be changed according to your service location and your client will need to point to that as well.
Just a guess..
My basic question is for guidance hosting a WCF service in IIS7 (2008 R2) on the default net.tcp port of 808 on a website other than "Default Web Site". I have 4 sites each bound to a specific IP address. I would like my WCF services to be hosted within a site other than the default using port 808. What is the catch here? I want to understand this without just using another port to solve the issue if that would even be the case.
I created this running question/log of trying to figure this out yesterday, but I just didn't have much luck. I had to move the WCF services back to the default website and move the net.tcp binding from my desired website back to the default as well.
moved net.tcp WCF services from localhost to IP address on new site, services won't load
I access my services using the technique of:
MyServiceClient : ClientBase<IMyService>, IMyDataService
and within the methods of the client:
return base.Channel.MyOperation(request);
I rely on the WCF configs in web.config of the hosting projects providing the .svc file to properly connect me to the WCF services. If this is sub-optimal, I am willing to change.
A typical client configuration in web.config looks as such:
<endpoint name="myServiceClient" address="net.tcp://localhost/MyServiceWebHost/MyService.svc/tcpEndpoint" binding="netTcpBinding" bindingConfiguration="myServiceNetTcpBinding" contract="Contracts.ServiceContracts.IMyService" />
Thanks for any pointers.
Its rights issue. Right click on your new website --> then Edit Permissions. On properties window click security tab and Edit button. Then Add IIS_IUSRS and give Read & execute, List folder contents, Read permissions. Now you can host and connect net tcp on new website.
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.
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.