locked
Calling WCF sample service from my webpage RRS feed

  • Question

  • I posted this question on the Visual Studio Developer Center >.NET Framework Forums > Windows Communication Foundation, Serialization, and Networking forum, but have had no response.  Is there a better forum for this question

    JSONP sample - JsonpAjaxService is not defined

    I am trying to call the Jsonp example from my website (c:\WR-WCF-Samples\WCF\Basic\Ajax\JSONP).

    Firebug indicates that I have a

    ReferenceError: JsonpAjaxService is not defined
    var proxy= new JsonpAjaxService.CustomerService();

    I placed the script and body from JSONPClientPage.aspx into my webpage, changing the ServiceReference Path to

                <asp:ServiceReference Path="h_ttp:/_/192.168.64.180/Service_deploy/service.svc" />

    I added service and behavior definitions to Web.Config:

    <system.serviceModel>
        <services>
          <service name=" JsonpAjaxService" behaviorConfiguration="MyServiceBehavior">
            <endpoint address=""
                      binding="webHttpBinding"
                      contract="service"
              behaviorConfiguration="web" />
          </service>
        </services>
        <behaviors>

          <serviceBehaviors>
            <behavior name="MyServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="web">
              <webHttp />
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </system.serviceModel>

    I built the solution in Visual Studio 2012 and then published the service to IIS.

    I assume that this is a Service/IIS/Website configuration issue, but I don't know what to change.  How does my webpage connect to JsonpAjaxService?

    Thanks so much for your help!

    Monday, May 6, 2013 7:13 PM

Answers