Hello:
Is it possible to use the same custom WCF service from two different web applications? For example, I have a WCF service deployed to ISAPI folder which I access from SiteA using the below endpoint address:http://siteA/_vti_bin/Upload/UploadService.svc
Now I would like to use the same WCF service from site B using the endpoint http://siteB/_vti_bin/Upload/UploadService.svc.
Below is how binding is configured in web.config of ISAPI/Upload folder:
<service name="..." behaviorConfiguration="..."><endpoint address="http://SiteA/_vti_bin/Upload/UploadService.svc" binding="webHttpBinding" behaviorConfiguration="..." bindingConfiguration="..." contract="..." /></service>
As you can see I hardcoded the address to point to SiteA.
When I open http://siteB/_vti_bin/Upload/UploadService.svc, I get below error: No protocol binding matches the given address 'http://SiteA/_vti_bin/Upload/UploadService.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
I understand the error is due to the hardcoded address and that is not matching Site B. If I provide relative address in the endpoint for service, I get below error:
There was no channel actively listening at 'http://SiteB/_vti_bin/Upload/UploadService.svc'.
This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
How can I modify the endpoint address so that I can reuse WCF service from two different web applications? How can I get over this hurdle?
Thanks!