Click here to Skip to main content
15,562,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here i created a server which returns Name. and i hosted that in a console application and make sure that my web service is correct i displayed current date & time. as i expected when i run the project i got the output as current date & time displayed in the console application output window. but after hosting my service in console application in an the base address i gave in my configuration file is not getting opened i am getting the following error (web page could not be found). why what could be the reason? and my code is


Console Application Program.cs

C#
using System.ServiceModel;
namespace HelloServicehost
{
    class Program
    {
        static void Main()
        {
            using (ServiceHost host = new ServiceHost(typeof(WcfServices.HelloService)))
            {
                host.Open();
                Console.WriteLine("Hello service started at " + DateTime.Now.ToString());
                Console.ReadLine();
            }
        }
    }
}


App.Config File in console Application


XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="WcfServices.HelloService" behaviorConfiguration="mexBehaviour">
        <endpoint address="HelloService" binding="basicHttpBinding" contract="WcfServices.IHelloService"></endpoint>
        <endpoint address="HelloService" binding="netTcpBinding" contract="WcfServices.IHelloService"></endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/"/>
            <add baseAddress="net.tcp://localhost:8090/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mexBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>



i have tried many times even changed some binding settings in iis but not working somebody help me out?

Thankyou
Posted

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