Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 656887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:45:48+00:00 2026-05-13T22:45:48+00:00

I have a problem with getting jquery to retrieve results from a WCF service.

  • 0

I have a problem with getting jquery to retrieve results from a WCF service. I am hosting the WCF service within IIS and when I attach the debugger to this process I can see that the code is processed successfully. However, when it hits the callback within jquery there is no data??

I have set up a trace on the wcf service and there are no errors. It just seems as though the data is lost after the wcf service method completes.

Here is the jquery code which calls the service:

$.get("http://ecopssvc:6970/ecopsService.svc/Echo", {echoThis: "please work"}, function(data) {
            alert("Data Loaded: " + data);
        });

Here is the wcf config:

    <system.serviceModel>
    <services>
      <service name="EcopsWebServices.EcopsService" behaviorConfiguration="EcopsServiceBehaviours">
        <endpoint address="" behaviorConfiguration="WebBehaviour"
          binding="webHttpBinding" bindingConfiguration="" contract="EcopsWebServices.IEcopsServiceContract" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="WebBehaviour">
          <webHttp />
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="EcopsServiceBehaviours">
          <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Here is the service contract:

    [ServiceContract]
public interface IEcopsServiceContract
{    
    [WebGet]
    [OperationContract]
    string Echo(string echoThis);

}

Here is the Service implementation:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class EcopsService : IEcopsServiceContract
    {

        #region IEcopsServiceContract Members

        public string Echo(string echoThis)
        {
            return string.Format("You sent this '{0}'.", echoThis);
        }

        #endregion
    }

Please help someone!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:45:49+00:00Added an answer on May 13, 2026 at 10:45 pm

    Make sure to set the factory to WebScriptServiceHostFactory in your .svc markup. Also make sure that the WCF service and the web page respect the same origin policy. Here’s a full working example:

    WCF Service:

    [ServiceContract]
    public interface IService1
    {
        [WebGet]
        [OperationContract]
        string Echo(string echoThis);
    }
    
    public class Service1 : IService1
    {
        public string Echo(string echoThis)
        {
            return string.Format("You sent this '{0}'.", echoThis);
        }
    }
    

    web.config:

    <system.serviceModel>
      <services>
        <service name="ToDD.Service1" 
                 behaviorConfiguration="ToDD.Service1Behavior">
          <endpoint address="" 
                    binding="webHttpBinding" 
                    contract="ToDD.IService1" />
          <endpoint address="mex" 
                    binding="mexHttpBinding" 
                    contract="IMetadataExchange"/>
        </service>
      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="ToDD.Service1Behavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="false"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
    

    service1.svc:

    <%@ ServiceHost 
        Language="C#" 
        Debug="true" 
        Service="ToDD.Service1" 
        CodeBehind="Service1.svc.cs" 
        Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"
    %>
    

    index.htm:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Test</title>
        <script type="text/javascript" src="jquery-1.4.1.js"></script>
        <script type="text/javascript">
        $(function() {
            $.getJSON('http://localhost:4660/service1.svc/Echo', { 
                echoThis: 'please work' }, 
                function(data) {
                    alert(data.d);
                }
            );
        });
        </script>
    </head>
    <body>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with getting this pop-up jquery: http://www.htmldrive.net/items/show/431/jQueryNotice-animated-notification-tooltip script to work in
I have problem with getting values from select option when use JQuery UI $('#id').combobox().
I have this problem getting my newly created php project on Netbeans work on
i have a problem, i'm working with jquery and some ajax requests. i'm getting
I have a strange problem with the jquery plugin and options getting over written.
I have problem getting newer version of jscrollpane to work with jQuery UI tabs.
I have a problem setting a cdata node with jquery. Getting cdata is easily
I have a problem with jQuery, my code looks ok, but I'm getting an
Just getting into jquery. This problem only occurs in IE 8, its fine in
I am new to jquery mobile, and am having problems getting content I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.