Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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()
        {
            // Edit the base address of Service1 by replacing the 'Service1' string below
            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
Posted
Updated 18-Apr-11 21:09pm
v2

There is probably already another application listening on port 51443.

just open a command prompt and enter 'netstat -ano' en search for the application listening on port 51433, kill this application and retry to run yours.
 
Share this answer
 
v2
Hi
The problem is that Service1 is already running on port 51443 with the URL

http://localhost:51443/Service1/HelloWorld

what I'd like is to be able to override the default helppage on:

http://localhost:51443/Service1/help

with my own.....

Regards,

Søren
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900