Reputation: 3681
If I host a publicly available WCF web service in IIS, how should I configure the endpoint address? I think I can use either:
<endpoint address="http://localhost/MyService" ... />
or
<endpoint address="http://example.com/MyService" ... />
In both cases, a client on another machine must use the second option for its client binding.
If I use Visual Studio to create the client, both server bindings seem to work fine. However, I think I had trouble using new-webserviceproxy in Powershell with the first option.
Does it matter which one I use on the server?
Upvotes: 0
Views: 4431
Reputation: 151740
MSDN: Specifying an Endpoint Address:
you must use relative endpoint addresses for IIS-hosted service endpoints. Supplying a fully-qualified endpoint address can lead to errors in the deployment of the service. For more information, see Deploying an Internet Information Services-Hosted WCF Service.
From that link:
When hosted in IIS, endpoint addresses are always considered to be relative to the address of the .svc file that represents the service. For example, if the base address of a WCF service is
http://localhost/Application1/MyService.svc
with the following endpoint configuration.<endpoint address="anotherEndpoint" .../>
This provides an endpoint that can be reached at
http://localhost/Application1/MyService.svc/anotherEndpoint
Upvotes: 1