Here i'am creating a Hello wcf service which returns a string and the code is following
code in app.config file
="1.0"="utf-8"
<configuration>
<system.serviceModel>
<services>
<service name="WcfDemo.HelloService" behaviorConfiguration="mexBehaviour">
<endpoint address="HelloService" binding="basicHttpBinding" contract="WcfDemo.IHelloService"></endpoint>
<endpoint address="HelloService" binding="netTcpBinding" contract="WcfDemo.IHelloService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
<add baseAddress="net.tcp://localhost:8010/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
and code in wcf service is
namespace WcfDemo
{
public class HelloService : IHelloService
{
public string Hello(string Name)
{
return "Hello " + Name;
}
}
}
Code in automatically generated classfile is
namespace WcfDemo
{
[ServiceContract]
public interface IHelloService
{
[OperationContract]
string Hello(string Name);
}
}
i have hosted this wcf service in console application and the code is
namespace HelloServicehost
{
class Program
{
static void Main()
{
using (ServiceHost host = new ServiceHost(typeof(WcfDemo.HelloService)))
{
host.Open();
Console.WriteLine("Service Started at @ " + DateTime.Now.ToString());
Console.ReadLine();
}
}
}
}
Here console application is hosted in consoleapplication successfully but when i trying to open http://localhost:8080/ iam not getting the wsdl document.
THE ERROR IAM GETTING IS
(Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured). HOW TO SOLVE IT?
actually iam learner of wcf services so i could not find the whether the error is thrown from the browser or from the application. some one help me thanks in advance.