Prabu Spark

Prabu Spark

  • NA
  • 124
  • 199.7k

Problem in creating multiple endpoints in WCF?

Feb 13 2014 2:06 PM
Hi sir,
I created wcf service to perform addition operation, its working fine in basichttp binding, i cant able to view that service in wshttp binding. I tested the wcf service using wcftestclient utility, it is showing only basic httpbinding. I attached the service and web.config for your reference. Kindly check the code and tell me the solution for this problem.


Service.cs
****************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
public class Service : IService
{
public int Add(int a,int b)
{
return a + b;
}
}


IService.cs
***************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
[ServiceContract]
public interface IService
{
[OperationContract]
int Add(int a, int b);
}


Web.config:
**************

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
</system.web>
<system.serviceModel>
<services>
<service name="ArithmeticService.Service">

<host>

<baseAddresses>
<add baseAddress="http://localhost:1234/arithmetics" />
</baseAddresses>
</host>
<endpoint address="ws" binding="wsHttpBinding" contract="ArithmeticService.IService"/>
<endpoint address="basic" binding="basicHttpBinding" contract="ArithmeticService.IService"/>

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>