Category: WCF

RIA Services: Access to operation ” 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
RIA Services access to operation 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).

Just Released: Silverlight 4 Tools for VS 2010, new SL themes and WCF RIA Services

Just in case you missed it, Tim Heuer has announced that Silverlight 4 Tools for Visual Studio 2010, WCF RIA Services and 3 new SL themes have been released today. This is an exciting news for Silverlight aficionados who have been waiting for the RTM version of SL4 Tools since the last RC who are itching to put their hands on this new set of goodies.

If you want to learn more about SL, the best place to start is to go to Silverlight.net and checkout the Getting Started section. I would also suggest you follow Tim’s blog and subscribe to his updates and also as follow Silverlight Cream for the latest stream of info from SL developers.

If you are looking for Silverlight books for beginners my suggestion would be to get Laurent’s book (a SL4 edition will come out in September) and start from there. You should also checkout Jeff Pairies mind boggling book about Silverlight animation and also John Papa’s classic SL book that talks about data-driven services with Silverlight. Although some of these books are 1-2 versions behind I still believe that there are a lot of value in them that you can still apply with your Silverlight 4 projects.

I’ve just downloaded the package via the WPI
and I can’t tell you how much excited I am to see SL4T-4-VS2010 RTMed.
This will surely be a fun week.

Nice, time to rock this ship!

My MIX09 10K Contest Entry: Silverlight Pregnancy Calendar

I had some free time during the holidays and saw at the MIX09 website that they have a contest entitled MIX09 10K Challenge where they ask participant to create a web application that is either using Microsoft® Silverlight™ or Windows Presentation Foundation, as a XAML Browser Application running in Partial Trust or as a ClickOnce application in 10 kilobytes or less. I decided to take a stab at it and this is what I’ve came up with

SilverCalendar: A Silverlight Pregancy Calendar

You can see the app live here http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051

Dont forget to vote when you’re there 😛 LOL

My primary motivation when I built the app is the idea of having something that is going to be useful and at the same time fun to build. My wife is currently 34 weeks pregnant and it made me think that a pregnancy calendar would be q great application to do since it relates to me and my current day to day life. I love pregnancy calendars because it gives you a good daily insight on the progress of your baby and what you might expected as you go along in your daily life as a soon to be parent.

The application that i built is using Microsoft Silverlight 2 with a backend WCF web service. You can find the pregnancy calendar web service here. I wasn’t able to add any animations to the application because I decided to concentrate in adding functionality to app rather than the eye candy’ With that said, I’ll be posting the non-10K application this week.

Be sure to comeback on this blog in the coming weeks because I’ll be publishing the source code to both project soon together with a 11 part tutorial and screencast walkthrough that i have prepared to show how to to build an application using .NET 3.5, WCF, WPF and Silverlight.