I'm trying to build my first WCF service. I've got the following behavior now.
- When I run my WCF service, I can send in input and get the right results in Testing Client.
- When I type
http://localhost:12345/Service1.svc
into Chrome, I get a page. - Clicking on
svcutil.exe http://localhost:12345/Service1.svc?wsdl
gives me an XML.
However, when I type http://localhost:12345/Service1.svc/test/13, I only get an empty response. There's nothing in there but <body>
with a <pre>
. What can I be doing wrong and how do i resolve it? (Keep in mind that I'm a rookie at this.) Once I'll get the behavior working the way I want (so I can see the right result in the browser) I'll be producing either REST or JSON data in XML format (if that's of any importance).
From this discussion I got this.
namespace WcfService1
{
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "/test/{indata}",
ResponseFormat = WebMessageFormat.Xml)]
String Ping(String indata);
}
}
As can be seen in this question my implementation is as follows.
namespace WcfService1
{
public class Service1 : IService1
{
public string Ping(String indata)
{
return "Pong " + indata;
}
}
}
The suggested web.config didn't work so I've tried to publish metadata (whatever that is) using the pointers in this article in combination with this discussion. My configuration file look pretty much as the one in the latter link (except that I've removed the diagnostic part).