I’m trying to get an endpoint working on IIS (Express).
When debugging the project in VS with IIS Express and opening the endpoint address in my browser, I just get a normal 404 error.
My web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug httpHelpPageEnabled="false" includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="A.B.C">
<host>
<baseAddresses>
<add baseAddress="http://localhost:15000"/>
</baseAddresses>
</host>
<endpoint address="Test" binding="basicHttpBinding" contract="A.B.IC" bindingConfiguration="A.B.C">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="A.B.C"
maxBufferPoolSize="20971520"
maxBufferSize="2097152"
maxReceivedMessageSize="2097152">
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
When I place a .svc-Datei with the following contents into the website root, its working fine:
<%@ ServiceHost Service="A.B.C" CodeBehind="Services/C.svc.cs" %>
When using IIS hosting you should not provide your own base address. The base address for the service is given by the location of a .svc file. The endpoint address is then relative to the .svc file
The .svc file is used by IIS to map the request to WCF (rather than, say, ASP.NET).
Now you can have a virtual .svc file rather than a physical one using serviceActivations or if you use ASpNetCompaibility to can remove the .svc part altogether using a ServiceRoute as this article shows