You do not need to set the mex endpoint for the REST service. Your web.config should look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="BookService">
<endpoint name="xml"
address="xml"
binding="webHttpBinding"
contract="BookStore.Contracts.IBookService"
behaviorConfiguration="poxBehavior" />
<endpoint name="json"
address="json"
binding="webHttpBinding"
contract="BookStore.Contracts.IBookService"
behaviorConfiguration="jsonBehavior" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="poxBehavior">
<webHttp />
</behavior>
<endpointBehaviors>
<behavior name="jsonBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
The above will output two endpoints: one that uses XML data, and one that uses JSON. Thus, setting two endpoints, such as, of course, is completely optional; this is just an example of what you could do.
REST; - global.asax.cs:
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(
new System.ServiceModel.Activation.ServiceRoute("books",
new System.ServiceModel.Activation.WebServiceHostFactory(),
typeof(BookStore.Services.BookService)
)
);
}
, web.config, :
http:
json, :
http: