DevPinoy.org
A Filipino Developers Community
   
RIA Services: Access to operation '<method name />' was denied

While working on RIA Services and Silverlight you might get an error like this:

ria services silverlight access to operation error was denied

Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8) Timestamp: Fri, 18 Feb 2011 18:20:46 UTC Message: Unhandled Error in Silverlight Application Load operation failed for query 'GetUserDetails'. Access to operation 'GetUserDetails' was denied. at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodPermissions(DomainOperationEntry domainOperationEntry, Object entity) at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodCall(DomainOperationEntry domainOperationEntry, Object[] parameters, ICollection`1 validationResults) at System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount) at System.ServiceModel.DomainServices.Hosting.QueryProcessor.Process[TEntity](DomainService domainService, DomainOperationEntry queryOperation, Object[] parameters, ServiceQuery serviceQuery, IEnumerable`1& validationErrors, Int32& totalCount) at System.ServiceModel.DomainServices.Hosting.QueryOperationBehavior`1.QueryOperationInvoker.InvokeCore(Object instance, Object[] inputs, Object[]& outputs) Line: 1 Char: 1 Code: 0 URI: http://yourapplicationwebsite/

The reason behind this is that the service you are calling requires privileges in order for it to be executed. This is specifically true when RequiresAuthenticationAttribute attribute or the RequiresRoleAttribute is applied to your service. To solve this error make sure that the application calling the service has the required access/permission to call the service method or you can remove both attributes on the service if the are not really needed(which might be risky).

Crossposted from: http://keithrull.com/blog/index.php/2011/02/net/ria-services-access-to-operation-was-denied/


Posted 02-18-2011 1:41 PM by keithrull
Copyright DevPinoy 2005-2008