Suppose I have a resource as shown below:
namespace OpenRastaApp.Resources
{
public class Foo
{
public string Bar { get; set; }
}
}
handler like:
namespace OpenRastaApp.Handlers
{
public class FooHandler
{
public object GetAll()
{
ArrayList foos = new ArrayList();
foos.Add(new Foo() { Bar = "Hello," });
foos.Add(new Foo() { Bar = " world!" });
List<Foo> result = new List<Foo>(foos.ToArray(typeof(Foo)) as Foo[]);
return result;
}
public object Get(int id)
{
return new Foo() { Bar = "Baz" };
}
}
}
and configurations like:
namespace OpenRastaApp
{
public class Configuration : IConfigurationSource
{
public void Configure()
{
using (OpenRastaConfiguration.Manual)
{
ResourceSpace.Has.ResourcesOfType<Foo>()
.AtUri("/foos")
.And.AtUri("/foos/{id}")
.HandledBy<FooHandler>()
.AsJsonDataContract();
}
}
}
}
/ foos / 1 displays as expected with
{"Bar":"Baz"}
however, / foos is not displayed at all. The message "8- [2010-09-22 13: 39: 29Z] Information (0) No response codec was found. The response object is null or the response code is already set." I confirmed that the result is not null before returning. I also tried returning Foo [], but had the same error.
source
share