Saturday, January 31, 2009

Silverlight 2 in Review and Silverlight 3 (yes Three) in Action Discussion

Silverlight has had some phenomenal success in the past six months. This success has been spread across several categories of experiences including, but not limited to:
  • Historical Events
  • TV and Movie Viewers
    • Netflix is using Silverlight for its Watch Instantly feature
    • Blockbuster will be using Silverlight for it's MovieLink functionality. If the NFL would do the same, I would actually watch the NFL online (Dear NFL: If you want to push advertisements on me, you must at least provide an experience I can endure. I will not use your current viewer. You are losing revenue. You should consider using Silverlight)
  • Sporting Events
  • Utilities
This is just a small sample of all of the applications that are popping up over the internet. I hope you have had the opportunity to experience one of these incredible Silverlight applications. I also hope you have learned a great deal about Silverlight. Perhaps you even learned a few things from Silverlight 2 in Action. If not, you can still pick up a copy here. Regardless, a follow-up to Silverlight 2 in Action is in being discussed (you can get a sneak peak of the features of SL3 here). I have not decided to what degree I will be involved at this time, that will be discussed at a later time. Regardless, before we get to that point, I wanted to do some refactoring and clean up Silverlight 2 in Action.

Based on the reader reviews on Amazon.com, it seems like most individuals were happy with Silverlight 2 in Action. I know that you cannot make everyone happy (as shown here). However, I do want to try to identify and remedy those flaws in Silverlight 2 in Action. We will attempt to address these flaws in Silverlight 3 in Action. With that said, would you please consider responding to the following questions:
  • What was missing from Silverlight 2 in Action?
  • What did you not like?
Thank you for reading! I'm sure it will be another exciting six months of Silverlight goodness!

Saturday, January 17, 2009

Windows 7 - Silverlight/ASP.NET Development - That assembly does not allow partially trusted callers

Greetings,

NOTE: This article is related to the Windows Beta. The accuracy of this article may change

Today I ran into an exception that stated: "That assembly does not allow partially trusted callers". This exception was thrown when I ran my server code on Windows 7 Beta. However, the same code did not throw an exception while running from Windows Vista. I think this problem is something that other Silverlight and ASP.NET developers may run into. Because of this fact, I decided to toss together a blog post related to it. This post will provide the background of the problem and the solution I came to.

Background
I had a basic Silverlight 2 input form application. This application connects to a standard .asmx running in a Windows 7 Beta environment. This .asmx uses the Enterprise Library to connect to a SQL Server 2005 instance. This SQL Server instance resides in the same Windows 7 Beta environment. When executing the code, I received an exception that stated: "That assembly does not allow partially trusted callers". Significantly, this exact code worked perfectly on Windows Vista.

After searching for the exception, I relized the problem was a bit different than the solutions I had seen. Instead, the Windows 7 Beta seems to do something very interesting with files moved between environments.

When files are moved to a Windows 7 Beta environment, they might be blocked to help protect the computer. I noticed this when I right-clicked on one of the Enterprise Library assemblies in my application and saw the following:



Here is what I did to get my project up and running again.

Solution
In order to solve the problem I did two things. First, I clicked the "Unblock" button. If you do not see an "Unblock" button, this means the file is already unblocked. Regardless, when I clicked the button, the previous text was grayed out as shown here:



To my surprise though, this did not entirely fix the problem. I then restarted IIS. This did not fix the problem. Finally, I resorted to restarting my machine. I'm guessing I need to restart the machine considering Windows 7 is in Beta at this point. Regardless, I am happy to announce that after restarting my machine, I was able to run my code again.

It is also important to recognize that all files the executing code touches may need to be unblocked. For instance, I had to unblock three different assemblies in order to get my code to actually work (I only needed to restart once though).

Do not let this post deter you from Windows 7. The Windows 7 Beta I am running is quite impressive. At first, I did not like the new taskbar. However, I can now say that I absolutely love it. I would defininately recommend giving the Windows 7 Beta a try.