tags:

views:

68

answers:

2

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.

A: 

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?

marc_s
A: 

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.

Nix
you are right. I setup the host header in iis/binding and everything is fine. thanks
Estelle