I keep getting a 404 on a very basic WCF service that I want to expose via REST - I'm trying to access it by going to this URL when debugging: http://localhost:62888/Service1.svc/xml/data/test
I can view the service info at http://localhost:62888/Service1.svc but not at http://localhost:62888/Service1.svc/xml
I'm using .Net 4 and its a WCF Service Application project. I tried debugging with Cassini as well as IIS Express
Web.Config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1">
<!-- address is relative-->
<endpoint address="xml" binding="webHttpBinding" behaviorConfiguration="webHttp" contract="IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp /> <!-- enables RESTful in conjunction with webHttpBinging -->
<enableWebScript /> <!-- allows ajax communication -->
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
IService.cs
using System.ServiceModel;
using System.ServiceModel.Web;
namespace CI.WcfRestTest
{
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "/data/{id}")]
string GetData(string id);
}
}
Service1.svc.cs
namespace CI.WcfRestTest
{
public class Service1 : IService1
{
public string GetData(string id)
{
return string.Format("You entered: {0}", id);
}
}
}
I've read a bunch of articles on the subject including this one REST / SOAP endpoints for a WCF service . Perhaps there's something in Cassini or my machine config thats goofing things up? I've read of issues with Windows Vista, but I'm on Windows 7 Pro. Perhaps it has something to do with a WCF Service Application as opposed to a WCF Service Library?