Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
REST WCF中的身份验证问题_Wcf_Heroku - Fatal编程技术网

REST WCF中的身份验证问题

REST WCF中的身份验证问题,wcf,heroku,Wcf,Heroku,我已经开发了REST WCF,并按照web.config中的方式设置绑定 <bindings> <webHttpBinding> <binding name="secureBasic"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="None" /> </security>

我已经开发了REST WCF,并按照web.config中的方式设置绑定

<bindings>
  <webHttpBinding>
    <binding name="secureBasic">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </webHttpBinding>
</bindings>

<serviceBehaviors>
    <behavior name="ServiceBehaviour" >
      <serviceCredentials>
        <userNameAuthentication customUserNamePasswordValidatorType="RestService.CustomUsernamePasswordValidator, RestService"
                            userNamePasswordValidationMode="Custom" />
      </serviceCredentials>
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>

  </serviceBehaviors>
现在的问题是,当我从同一个项目中使用这个服务时,它运行得很好,但我不明白为什么这个调用不会用于验证

另外,当我从ruby commnad PROMPT测试我的heroku清单加载项文件时,它给我的错误是 身份验证失败!!我认为这是我的REST WCF应用程序的问题

请任何人都可以帮助我解决这个问题,如果有人非常了解WCF和身份验证

谢谢
Arun。

最后,我可以直接使用WebOperationContext处理自定义身份验证,并跳过Web.Config设置。

是否收到任何错误消息?您可能应该在此处发布密码后更改密码:)Ruby命令提示符中的身份验证失败。。感谢您的建议。请将您的问题标题设置得更详细:
namespace RestService
{
public class CustomUsernamePasswordValidator : UserNamePasswordValidator
{
    public override void Validate(string userName, string password)
    {
        if (!AuthenticateUser(userName, password))
            throw new SecurityTokenValidationException("Invalid Username or Password");
    }

    private bool AuthenticateUser(string userName, string password)
    {
        if (userName == "myaddon" && password == "mypassword")
        {
            return true;
        }
        else
            return false;
    }
}
}