Похоже, что проблема в Binding для REST должна быть webHttpBinding . Я внес некоторые изменения в ваш web.config.try this
<system.serviceModel>
<services>
<service name="wcf_geolocation" behaviorConfiguration="ServiceBehavior">
<!-- not sure which class I should name here, see my attached code for definition of interface-->
<host>
<baseAddresses>
<add baseAddress="http://www.domain.nl/api" />
<!-- /api is the URL I want, do I need to configure that in URL rewrite or IIS or...?-->
</baseAddresses>
</host>
<endpoint address="getobjects" behaviorConfiguration="JsonBehavior" binding="webHttpBinding" contract="Iwcf_geolocation" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
EDIT
Привет! Я обновил ответ в соответствии с вашим комментарием. Пожалуйста, посмотрите и дайте мне знать.
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.ServiceModel
Imports System.ServiceModel.Description
Imports System.ServiceModel.Web
Imports System.Text
' NOTE: You can use the "Rename" command on the context menu to change the interface name "Iwcf_geolocation" in both code and config file together.
<ServiceContract> _
Public Interface Iwcf_geolocation
<OperationContract> _
Sub DoWork()
<OperationContract> _
<WebGet(RequestFormat := WebMessageFormat.Json, ResponseFormat := WebMessageFormat.Json, UriTemplate := "EchoWithGet/{s}")> _
Function EchoWithGet(s As String) As String
<OperationContract> _
<WebInvoke(Method := "POST", UriTemplate := "EchoWithPost/{s}", BodyStyle := WebMessageBodyStyle.Bare)> _
Function EchoWithPost(s As String) As String
End Interface
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
' NOTE: You can use the "Rename" command on the context menu to change the class name "wcf_geolocation" in code, svc and config file together.
Public Class wcf_geolocation
Inherits Iwcf_geolocation
Public Sub DoWork()
End Sub
Public Function EchoWithGet(s As String) As String
Return "You said " & s
End Function
Public Function EchoWithPost(s As String) As String
Return "You said " & s
End Function
End Class
<ч />
<behaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Как проверить сервис в браузере
http://[XXXX.XXX]/ServiceName.svc/EchoWithGet/peter
для EchoWithPost службы, вы должны написать код или вы можете проверить это с помощью fiddler.