I've been trying to find a way to override the default WVF REST 4.0 helppage with my own one, and came across this post:
http://code.msdn.microsoft.com/WCF-Custom-Help-Page-6f5a90f0
I've been trying to use the same approach in an IIS hosted service using the following code:
namespace WcfHelpRestService
{
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes();
}
private void RegisterRoutes()
{
var factory = new MyServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("Service1", factory, typeof(Service1)));
}
}
}
namespace WcfHelpRestService
{
public class MyServiceHostFactory : WebServiceHostFactory
{
public MyServiceHostFactory ()
{
}
protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
return new MyServiceHost(serviceType, baseAddresses);
}
}
}
namespace WcfHelpRestService
{
public class MyServiceHost : WebServiceHost
{
public MyServiceHost(Type serviceType, Uri[] baseAddresses): base(serviceType, baseAddresses)
{
}
public override void AddServiceEndpoint(System.ServiceModel.Description.ServiceEndpoint endpoint)
{
endpoint.Behaviors.Add(new HelpPageEndpointBehavior("ACME LLC"));
base.AddServiceEndpoint(endpoint);
}
}
}
however I keep getting the error:
[AddressAlreadyInUseException: HTTP could not register URL http://+:51443/Service1/help/ because TCP port 51443 is being used by another application.]<br />
System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() +1106
not quite sure what I'm doing wrong, so any help would be greatly appreciated.
TIA
Søren