This is my first web service and I am trying to follow a tutorial on creating a custom authentication for a web service, am stuck as I'm getting this error:
The value 'WcfOrderingService.Services.AuthenticationTokenService' is invalid according to its datatype 'serviceNameType' - The Enumeration constraint failed.
web config:
<service name ="WcfOrderingService.Services.AuthenticationTokenService"
behaviorConfiguration="ServiceBehaviourHttp">
<endpoint address="" behaviorConfiguration="WcfOrderingService.AuthenticationTokenServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="WcfOrderingService.Services.AuthenticationTokenService.Authenticate" />
</service>
.svc.cs -
namespace WcfOrderingService.Services
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class AuthenticationTokenService
{
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
[OperationContract]
public string Authenticate(Credentials creds)
{
ICredentialsValidator validator = new CredentialsValidator();
if (validator.IsValid(creds))
return new TokenBuilder().Build(creds);
throw new InvalidCredentialException("Invalid credentials");
}
}
}
I have tried most things I have found online, variations of the service name etc but cant find an answer.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire