Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not a WCF expert, so I cannot tell you what is wrong with your current application, but I can give you instructions for setting up a very simple example using your code, which will return a result in Fiddler.</p> <ol> <li>Create a new ASP.NET <strong>Empty</strong> Web Application</li> <li>Add a code file with the following:</li> </ol> <p>Normally I wouldn't put everything in one file, but for simplicity...</p> <pre><code>using System.Collections.Generic; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; namespace WebApplication1 { [ServiceContract] public interface ITestService { [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] List&lt;Person&gt; GetResults(); } public class TestService : ITestService { public List&lt;Person&gt; GetResults() { List&lt;Person&gt; results = new List&lt;Person&gt;(); results.Add(new Person("Peyton", "Manning", 35)); results.Add(new Person("Drew", "Brees", 31)); results.Add(new Person("Tony", "Romo", 29)); return results; } } [DataContract] public class Person { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public int Age { get; set; } public Person(string firstName, string lastName, int age) { this.FirstName = firstName; this.LastName = lastName; this.Age = age; } } } </code></pre> <p>Update the <code>web.config</code> file:</p> <pre><code>&lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;serviceHostingEnvironment&gt; &lt;serviceActivations&gt; &lt;add relativeAddress="test.svc" service="WebApplication1.TestService" factory="System.ServiceModel.Activation.WebServiceHostFactory" /&gt; &lt;/serviceActivations&gt; &lt;/serviceHostingEnvironment&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>You don't need a .svc file, so start the application, making note of the root url used by the ASP.NET Development Server. On the Request Builder tab of fiddler enter your url:</p> <p><img src="https://i.stack.imgur.com/wgKXd.png" alt="enter image description here"></p> <p>Click the Execute button and you should see your service results:</p> <p><img src="https://i.stack.imgur.com/gt517.png" alt="enter image description here"></p> <p>Hopefully you can use this to figure out what you need to update on your service to get it running. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload