I am using a Silverlight application that has a net.tcp WCF connection. I would like to place ClientAccessPolicy.xml on ServiceHost myself, and the policy file should be in the root, port 80, in accordance with the requirements of Silverlight net.tcp (TCP port 4502-4534, etc.). My problem is that when my ServiceHost is running, it steals the 80 root port from IIS and none of my web pages work.
The code for creating the policy endpoint is as follows:
host.AddServiceEndpoint(typeof(IPolicyGetter), new WebHttpBinding(), "http://localhost/").Behaviors.Add(new WebHttpBehavior());
When ServiceHost is working, I can see my http://127.0.0.1/ClientAccessPolicy.xml , but all the websites on port 80 stop working - I see that the standard WCF "Endpoint not found" webpage created by the endpoint . When I turn off ServiceHost, I can see my website, but ClientAccessPolicy.xml does not work.
I tried using the full path for the endpoint URI:
policyUri.Scheme = "http"; policyUri.Port = 80; policyUri.Query = "ClientAccessPolicy.xml"; host.AddServiceEndpoint(typeof(IPolicyGetter), new WebHttpBinding(), policyUri.ToString()).Behaviors.Add(new WebHttpBehavior());
but this throws an argument exception. Moving a policy to a subdirectory or to another port will not work because Silverlight looks at port 80 in the root directory.
Obviously, I can simply copy the ClientAccessPolicy.xml file to the root directory of the website and disable the policy endpoint. Is there a way to block the endpoint so that it only picks up ClientAccessPolicy.xml calls but doesn't steal the entire IIS port 80?
source share