I am trying to set up a WCF Service but I'm having a few problems. The service works and loads the wsdl page when I type in
www.mydomain.com/Service1.svc
However when I use
www.mydomain.com/Service1.svc/
or try to use any of the get methods I get
The resource cannot be found.
Description: HTTP 404.
My web.config file is as follows
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<remove name="PageHandlerFactory-ISAPI-4.0"/>
<add name="PageHandlerFactory-ISAPI-4.0" path="*" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<remove name="ASP.NET-ISAPI-4.0-Wildcard"/>
<add name="ASP.NET-ISAPI-4.0-Wildcard"
path="*" verb="GET,HEAD,POST,DEBUG"
modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<remove name="svc-Integrated-4.0" />
<add name="svc-Integrated-4.0" path="*" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0">
</compilation>
<httpHandlers>
<remove verb="*" path="*.svc"/>
<add path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
</httpHandlers>
</system.web>
<system.serviceModel>
<services>
<service name="RestService.Service1" behaviorConfiguration="ServiceBehaviour" >
<endpoint address="" binding="webHttpBinding" contract="RestService.IService1" behaviorConfiguration="web">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://mydomain.com/Service1"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour" >
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
The Service.svc file is as follows :
namespace RestService
{
public class Service1 : IService1
{
public bool LoginUser( string Username, string password )
{
return true;
}
}
}
and the IService.cs is as follows:
namespace RestService
{
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
//BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "login/{username}/{password}")]
bool LoginUser(string username, string password);
}
}
The pipeline mode on the server is "Integrated" if that helps. I'm not sure what IIS version my hosting provider (pipeten) uses but I think it's 7.5 I have a feeling this has something to do with the URL validation however there is no option on my hosting to change this.