DomainService1은 SOAP 서비스로 제공되는 RIA 도메인 서비스입니다. 이 서비스는 [RequiresAuthentication] 및 [RequiresRole ("xyz")] 특성을 사용하여 보호되었습니다.RIA 도메인 서비스의 인증 문제 (작업에 대한 액세스가 거부 됨)
web.config에서 roleManager를 활성화하고 인증 모드를 Forms로 설정했습니다.
테스트 클라이언트는 인증 및 원격 서비스 작업 호출하려면 다음 코드를 사용 : 나는 auth.Login에 대한 호출이 실제로 올바른 사용자를 반환 볼 수 있습니다
var auth = new myAuth.AuthenticationDomainServiceSoapClient();
var svc = new mySvc.DomainService1SoapClient();
try
{
string myCookie;
using (new OperationContextScope(auth.InnerChannel))
{
var user = auth.Login(svcUser.Text, svcPass.Text, false, string.Empty);
var res = (HttpResponseMessageProperty)OperationContext.Current.IncomingMessageProperties[HttpResponseMessageProperty.Name];
myCookie = res.Headers[HttpResponseHeader.SetCookie];
}
using (new OperationContextScope(svc.InnerChannel))
{
var octx = OperationContext.Current;
HttpRequestMessageProperty request = new HttpRequestMessageProperty();
request.Headers["Cookie"] = myCookie;
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = request;
var results = svc.GetItems();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
을, 그 객체에 난을 볼 수 있습니다 역할이 올바르게 설정되었습니다. 그러나 GetItems에 대한 호출이 실패하고 "작업에 대한 액세스가 거부되었습니다"라는 예외가 발생합니다.
뭔가 내려다 보입니까? 제가 빠뜨린 명백한 것을 볼 수 있습니까? 사전에
감사합니다,
건배, 지안루카.
[편집] 내가이 얻을 이벤트 로그에 그것을 추가 할 : 폼 인증 요청에 실패했습니다. 이유 : 제공된 티켓이 유효하지 않습니다.
이유에 대해 알고 싶습니다.
건배.