Freigeben über


Connecting to an SSL WCF Service with Windows Phone 7 Emulator

Had lots of fun earlier trying to figure out why my Windows Phone 7 application could not connect to my WCF endpoint.  I had tested things out thoroughly with a standard winforms client application and everything worked great, but whenever I tried hitting the same endpoint from my WP7 emulator I'd get the annoying error along the lines of "no endpoint listening" and if you look at the inner exception it was something like a 404 not found response.  Of course this was completely silly, the endpoint was there.  There were two things that I learned to resolve this:

  1. The error really meant that the phone emulator did not have the root certificate authority for the SSL cert in its list of trusted certs.  Unfortunately even with the WP7 1.1 (i.e. Mango SDK), there does still not appear an easy way to do this.  What you really need to do is put the root CA .cer file into a zip file somewhere, and then put it up on a web site where you can download it.  It could be a local development server, you can email it to yourself at something like HotMail, etc.  Navigate to that file from within the emulator and it will download it then show you the contents of the zip file.  If you click on the .cer file then it will offer to install it for you.  Take it up on this offer and it will put it in the list of trusted certificate authorities and you are good to go.  Or so it may seem... (see the next item)
  2. The steps I described in #1 work great...until you stop and restart the emulator.  It has no persistent state it seems so everytime you happen to stop it (or the many times it gets stopped itself and/or disconnected from Visual Studio) you have to repeat step 1 all over again.  Every time.  Painful as heck.  Not sure if this is on the fix radar or not but I guess we'll see.

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    August 22, 2011
    I do not understand why Microsoft has a problem with <a href="http://certsuperior.com/" rel="SSL">SSL</a> certificates. It is the Internet security standard. The truth, that is problematic and bored because every time you want to make a connection to the WCF Service have to make the whole process. Of course it isn't surprising that Microsoft also is losing ground in the mobile operating systems.

  • Anonymous
    September 18, 2014
    The comment has been removed

  • Anonymous
    January 15, 2015
    m88 : http://m88en.com
    M88.com offer online sports games Asia, Sports Betting Asia, Sports Betting Sites Asia.
    m88asia : http://m88en.net
    Link to M88BET phone: m88en.com. – Register and Open Betting Account and Membership M88BET.
    m88bet : http://www.linkm88vip.com
    MANSION88 the house is one of the largest and most prestigious. Appeared quite early in the Asian market, the so-MANSION88 currently attracts more players.
    link m88 : http://m88wiki.com
    Home the M88 is the official sponsor of the football club in the Premier League
    Wish you happy with the new M88
    m88 casino online : http://m88free.com

    Modern Thai restaurant combines outstanding traditional cuisine and a subtle modern decor with a warm welcoming ambience. Thai Restaurants in Brisbane :http://www.watersidethainoodles.com.au , traveller reviews of Brisbane Thai restaurants and search by price, location, and more.