Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I developed one rest service application with two different service contracts one is for Rest Client and another one is for normal web service request. But i am getting the below exception on Service routing time. Please help me

Exception

Service implements multiple ServiceContract types, and no endpoints are defined in the configuration file. WebServiceHost can set up default endpoints, but only if the service implements only a single ServiceContract. Either change the service to only implement a single ServiceContract, or else define endpoints for the service explicitly in the configuration file.


My Config setting is

What I have tried:

XML
<system.webserver>
    <modules runallmanagedmodulesforallrequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0,Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
  </system.webserver>
  <system.servicemodel>
    <services>
      <service name="VoipRest.Service1">
        <endpoint address="JSON" binding="webHttpBinding" behaviorconfiguration="JSONBehavior" bindingnamespace="http://plintron.com/" contract="VoipRest.IService" name="REST" />
        <endpoint address="SOAP" binding="basicHttpBinding" bindingnamespace="http://plintron.com/" contract="VoipRest.Iservice2" name="SOAP" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <basichttpbinding>
        <binding name="" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" transfermode="Streamed" opentimeout="00:25:00" closetimeout="00:25:00" sendtimeout="00:25:00" receivetimeout="00:25:00" maxbuffersize="2147483647">
          <readerquotas maxdepth="64" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" />
          <!--<security mode="Transport" />-->
          <security mode="None" />
        </binding>

      </basichttpbinding>
      <webhttpbinding>
        <binding name="" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" transfermode="Streamed" opentimeout="00:25:00" closetimeout="00:25:00" sendtimeout="00:25:00" receivetimeout="00:25:00" maxbuffersize="2147483647">
          <readerquotas maxdepth="64" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" />
          <!--<security mode="Transport" />-->
          <security mode="None" />
        </binding>

      </webhttpbinding>
    </bindings>
    <behaviors>
      <endpointbehaviors>
        <behavior name="JSONBehavior">
          <webhttp />
        </behavior>
      </endpointbehaviors>
      <servicebehaviors>
        <behavior name="">
          <!--<servicemetadata httpgetenabled="false" httpsgetenabled="true" />-->
          <servicemetadata httpgetenabled="true" httpsgetenabled="false" />
          <servicedebug includeexceptiondetailinfaults="true" />
        </behavior>
      </servicebehaviors>
    </behaviors>
    <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />
    <standardendpoints>
      <webhttpendpoint>
        <!-- Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardendpoint> element below -->
        <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="false" defaultoutgoingresponseformat="Json" maxbuffersize="2147483647" maxreceivedmessagesize="2147483647" />
      </standardendpoint></webhttpendpoint>
    </standardendpoints>
  </system.servicemodel>
Posted
Updated 2-Mar-16 5:38am
v2
Comments
Richard Deeming 2-Mar-16 11:40am    
So do what the exception tells you to, and define the endpoints in the configuration file:
How to: Create a Service Endpoint in Configuration[^]

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