1

I configured traditional WCF Services using SOAP end points. In my client project I added the Service Reference, etc. These are working as expected.

I created a JSONP enabled WCF Service, made the modifications to the .svc file, web config, etc. I created a test client page to test. I am successfully calling the JSONP Service.

However, the changes I made to the web config broke the service reference for the SOAP services. I'd like to use both type of end points. I am not sure how to configure the services and web config.

If http get only, can every operation (regardless if it is intended for SOAP or JSONP) be decorated with: [WebGet(ResponseFormat = WebMessageFormat.Json)]

Then my Service Class needs: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

When I now attempt to Update my Service Reference in my client project I am getting

A binding instance has already been associated to listen URI 'http://flixsit:1000/FlixsitWebServices.svc'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.

Adding SOAP configuration to my webconfig also breaks the JSONP endpoint. Calling JSONP on the client side doesnt require client service reference (or proxy generation), but SOAP does, correct?

My Service WebConfig:

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <behavior name="webHttpBehavior">
        <webHttp />
      </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
      <behavior name="DefaultBehaviors">          
        <serviceMetadata httpGetEnabled="true" />          
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <webHttpBinding>
      <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
    </webHttpBinding>
    <basicHttpBinding>
      <binding name="BasicHttpEndpointBinding" />
    </basicHttpBinding>
  </bindings>
  <services>
    <service name="Flixsit.Services.FlixsitWebServices" behaviorConfiguration="DefaultBehaviors">
      <endpoint name="JSONPEndPoint" address=""
                                   binding="webHttpBinding"
                                   bindingConfiguration="webHttpBindingWithJsonP"
                                   contract="Flixsit.Services.IFlixsitWebServices"
                                   behaviorConfiguration="webHttpBehavior" />
      <endpoint name="HttpEndPoint"  address=""
                                   binding="basicHttpBinding"
                                   contract="Flixsit.Services.IFlixsitWebServices" />
      <host>
        <baseAddresses>
          <add baseAddress="http://Flixsit:1000/FlixsitWebServices.svc" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
obautista
  • 3,517
  • 13
  • 48
  • 83

1 Answers1

0

The error clearly describes the problem. You have two endpoits with the same address but different bindings. It is not allowed. Set address="jsonp" in the endpoint with binding webHttpBinding. You will call the endpoint on /Service.svc/jsonp

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • Did this and getting HTTP status 400. I was not able to either add the Service Reference (SOAP) or call the JSONP EndPoint. I removed this line: Factory="System.ServiceModel.Activation.WebServiceHostFactory", from my .svc file, and was able to add Service Reference - however, the JSONP is still not working. Thanks for any help given... – obautista Jan 14 '11 at 13:07