Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create a web service that will serve both Ajax calls (JSON) and C# form Application calls.I understand the endpoints i need and can get both to work individually, however i cannot get them to work at the same time.

First i tried this:
XML
<services>
      <service name="MyWebService.Service" behaviorConfiguration="WebServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" contract="MyWebService.IService" behaviorConfiguration="JsonBehaviour">
          <identity>
            <dns value="ServerName"/>
          </identity>
        </endpoint>        <endpoint address="" binding="basicHttpBinding" contract="MyWebService.IService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

I then progressed to this:
XML
<services>
      <service name="MyWebService.Service" behaviorConfiguration="WebServiceBehaviour">
       <endpoint address="" binding="basicHttpBinding" contract="MyWebService.IService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      <service name="MyWebService.Service" behaviorConfiguration="WebServiceBehaviour">

        <endpoint address="" binding="webHttpBinding" contract="MyWebService.IService" behaviorConfiguration="JsonBehaviour">
          <identity>
            <dns value="ServerName"/>
          </identity>
        </endpoint> 
 </service>
</services>

Neither of these attempts worked, and now i am compeltely stumped. Is what i am trying to do even possible?
Posted
Updated 20-Aug-13 20:40pm
v2

1 solution

Hi ,
You need to create multiple bindings and endpoints for your service.
Have a look
--Avinash
 
Share this answer
 

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