Andreas Drake

Hi all!

I'm new to WCF and have a problem. I have created a simple "HelloWorld" Service that is hosted on a IIS 6.0 (on Windows 2003).

The local computername of the server is "srv.andreasdrake.local" but to access it outside (from internet) I have the domain http://andreasdrake.se

The problem I have is that when I try and access the service outside the local network it tries to connect to http://srv.andreasdrake.local:8080/WCFHelloWorldService/Service.svc

instead of

http://andreasdrake.se:8080/WCFHelloWorldService/Service.svc

you can see it for your self it you go to http://andreasdrake.se:8080/WCFHelloWorldService/Service.svc

How do I fix this Is it something I change in the web.config file or is it something I change in the client that uses the service

/Andreas




Re: Windows Communication Foundation (Indigo) New to WCF and problem to connect to a WCF Service in IIS outside local network

Jeff Cao

You should be able to define the URL used to access your service at the time you host it, like in following sample code:

public static void Main(string[] args)

{

        using (ServiceHost service = new ServiceHost(typeof(MyServices), new Uri(http://andreasdrake.se:8080/WCFHelloWorldService)))

        {

                service.Description.Behaviors.Add(new ServiceMetadataBehavior());

                service.AddServiceEndpoint(typeof(IMyService1), new BasicHttpBinding(), "IMyService1");

                service.Open();

                ...

                service.Close();

        }

}

You can also use the config setting to define the URL used by client to access the WCF service following the link below:

http://msdn2.microsoft.com/en-us/library/ms733766.aspx





Re: Windows Communication Foundation (Indigo) New to WCF and problem to connect to a WCF Service in IIS outside local network

Andreas Drake

Thanks got it working :)