Please help get an exception in using (ServiceHost host = new ServiceHost(typeof(HelloService.HelloService))) in the code below
Exception: only an absolute URI can be used as the base address
WCF host application
class Program { static void Main() { using (ServiceHost host = new ServiceHost(typeof(HelloService.HelloService))) { host.Open(); Console.WriteLine("Service Started"); Console.ReadLine(); } } }
Contract implementation
public class HelloService : IHelloService { public string GetMessage(string Name) { return "Hello" + Name; } }
Contract
[ServiceContract] public interface IHelloService { [OperationContract] string GetMessage(string Name); }
App.Config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="HelloService.HelloService" behaviorConfiguration="mexBehaviour"> <endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService"> </endpoint> <endpoint address="HelloService" binding="netTcpBinding" contract="HelloService.IHelloService"> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"> </endpoint> <host> <baseAddresses> <add baseAddress="http://localhost:8080/HelloService"/> <add baseAddress="net.tcp//localhost:8090/HelloService"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="mexBehaviour"> <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
source share