Skip to main content

Latest Posts:

Silverlight Visual Studio XAML Design view not working
Entry Date: Mar 2009 keywords: Silverlight; VS 2008; .net framework 3.5; Visual Studio 2008; XAML;
Short Description:This one is an strange one... in some Visual Studio installations you can find that the XAML view is not working at all (no design view, not even code formatting), even if you go to your IDE options you get a nasty message in the XAML part (an error ocurred loading this property page)
Entry:

This one is an strange one... in some Visual Studio installations you can find that the XAML view is not working at all (no design view, not even code formatting), even if you go to your IDE options you get a nasty message in the XAML part (an error ocurred loading this property page)

A solution for this issue: reset the IDE settings, go to Start >> All Programs Visual Studio 2008 >> Visual Studio Tools >> Visual Studio 2008 Command Prompt, and run this command:

    
devenv /resetskippkgs


Silverlight + WCF + SSL + Authentication quick troubleshooter
Entry Date: Nov 2008 keywords: WCF; Hosting; Security; Silverlight; Web Services; .net framework 3.5;
Short Description:

Some days ago I had to deploy my application into SSL hosting and add Authentication.

I have compiled the issues and solutions that I found, hope that this could save you some headaches

Entry:

Playing with Silvelright is nice, but… What happens when you convince your boss to do a real development? Suddenly you find you that most of the samples that you have used runs under naïve HTTP and what’s worse they don’t care about security or authentication, even you can be months developing using your cassini under http… but normally that won’t be your real business scenario, isn’t it?

Now, don’t panic :-), It’s possible to use SSL + Authentication on Silverlight? The answer is yes, Does it support all the possible scenarios? The answer is NO.

If you want to use SSL+Auth you have to configure your services as you did on your AJAX application, they must have session enabled, and you get the context information from there (e.g. user logged in), what does this mean? Like in AJAX applications you will have to perform regular pings, or have some service authentication where you can automatically login once the session expires (there are other solutions, but seems complex to me, poor silly dude).

That’s for services, but what about making direct calls to cross domain using WebClient or HttpWebRequest plus Credentials? It is not possible to supply credentials for HTTP auth in SL2 due to limitations in NPAPI. Since this is a cross domain scenario, you would need to tunnel the request through a proxy service on the server first where they would have complete control over the request.

Another issue that you will find, is that, in some scenarios, you will need to have to WCF and IIS knowledge to config… so you will face the devil doubt, Is a Siliverhght issue, is a WCF config issue, or is a IIS issue?

In my case, after some googling and good community help I manage to get my Silverlight + SSL + Authentication up and running, below you will find a compilation of troubleshooters links that I have found in that way, hope to save you some headaches.

General Errors

Not found Error: You attempt to make a call to the service and you get a “Service Not Found” error.

  • Are IIS Web Services enabled? By default not,check it out on your IIS management console:
    WCF 

services enabled
  • Is WCF right installed / registered? You can try to reinstall it using an Ms Dos command (just make a checkpoint before doing this ;-)), or register manually our svc. extension. Check out this link and this other one
  • Right service URL: Just display the URL of your service in a text box to ensure that you are calling the right one (copy it and paste over your navigator and check that you get a valid page).
  • If you are not sure if your WCF is right configured, you can try as well to create an old asmx webservice and check if things are working for that (if asmx works, you have to check your WCF config ). :-)

Cross Domain error on Same Domain call

  • Your site is something like https://mysite.com and the service call tries to call https://www.mysite.com : This is an strange case, I found some solution, but lost the link, if you have that issue ping me and let’s see if we can find that solution :-).
  • Another pain in the neck, is go configuring your URL’s to support development and production, if you are not making cross domain calls, there is a trick to automate this (Host.Source), check out this post
  • Another issue comes when you are on HTTP and try to make a call to a service that is under HTTPS, you will need to place on the root of your IIS a policy file (bad thing if you are sharing hosting).

Failed to call SSL

  • Configure your WCF service to use SSL: (transport…), how to
  • You will need valid certificates.. there is a way to generate something for dev purposes as well.

Authentication: you must rely on ASP .net session + Authentication

  • Here you will find an auth solution using Windows Live ID:
  • About using ASP .net Membership, check out basics, roles roles and an step by step tutorial.
  • About how to configure web service to work with session:
      
        [ServiceContract(Namespace = "")]
        [AspNetCompatibilityRequirements(RequirementsMode = 
    
    AspNetCompatibilityRequirementsMode.Allowed)]
        public class MyService    
        
          
        [OperationContract]
        public EntityAccountsShared GetSharedAccountsForGivenFolder()
        {
        // Accesing HTTP Context session content
        HttpContext.Current(...)
        (...)
        }
        

Other Errors:

Hope this helps.



Silverlight 2.0 Beta 2 plus ADO .net Entity Framework not working yet
Entry Date: Aug 2008 keywords: WCF; ADO .net; Silverlight; VS 2008; Visual Studio 2008; XAML;
Short Description:

Visual Studio SP-1 has been released and one of the major updates of this Service Pack is the RTM of the ADO .net Entity Framework. Does this integrate well with the current Beta 2 version of Silverlight + WCF ? ... in theory yes, but in practice...

Entry:

Visual Studio SP-1 has been released and one of the major updates of this Service Pack is the RTM of the ADO .net Entity Framework.

In the July issue of the MSDN Magazine there was a very interesting article by John Papa: The Entity Framework In Layered Architectures there you will find how to build up a cutting edge architecture using:

  • --> Front End / UI: WPF (Windows Presentation Foundation).

  • --> Service Layer: WCF (Windows Communication Foundation).

  • --> DAL / Data Access Layer: ADO .net Entity Framework.

Most of the geeks that have read this article (including myself), thought: WOW !! For sure this can be ported to Silverlight, instead of wondering why… the samples haven’t been built for Silverlight ?.

The thing is… you start building your solution: no problem with the UI layer, no problem exposing WCF services and consuming them from Silverlight Beta 2, but now the problem comes serializing ADO .net entities, Why is so important this entity serialization?:

  • --> One of the powerful things of ADO .net entity framework is that entity objects can be serialized.

  • --> This means that they can be passed between layers, even via web services.

  • --> It saves a lot of useful information.

  • --> Let’s you forget about having custom made entity classes.

You realize that things are not working when you add the service reference to your silverlight project and try to compile, you get the following error message:

'System.Runtime.Serialization.DataContractAttribute' does not contain a definition for 'IsReference'

In the proxy autogenerated code:

  
[System.Runtime.Serialization.DataContractAttribute(Name="StructuralObject", 
Namespace="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses", 
IsReference=true)]

If you start googling you find some threads that will get a chimp busy for a day… uninstall all for visual studio stuff, extensions, service pack, … and try again

What does Ms Chaps say about this ?

Comment 1:

The mismatch of the Client library and the Server dll is fixed in later releases of the Silverlight SDK. You will be able to use the EF generated types in your SIlverlight application in the near future . Unfortunately , I can't give you a date of when the next Silverlight SDK is gonna be released , but rest assured , this scenario WILL work when the next Silverligtht SDK ships

Comment 2:

Hi, as discussed earlier, support for IsReference will be added in RTW.

Is there a Workaround?

Your code will compile if you remove from the autogenerated code the IsReference=True, but you will then face inconsistencies in the serialized objects coming back intact.

So… it seems that we will have to wait for the RTW version.

My opinion: is normal that a Beta version contains bugs, it’s normal that the Ms Development team cannot focus on preparing hot fixes, they must keep their minds on the next iteration, BUT they should have a daily updated page including well known errors and possible workarounds or when is expected to have a fix for that bug, it’s quite disgusting to find the error, read some unofficial thread, fully reinstall Visual Studio and later find that.. uh ! it was a bug…

More information:

Ms ADO .net Entity Framework forum (Patrick Magee MSFT)

Silverlight forum (Yin-Lun Luo MSFT)



<< Previous Articles Page (2) Of 7 Next Articles >>