Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. WCF Client Differences

WCF Client Differences

Scheduled Pinned Locked Moved WCF and WF
csharpwcfhostingsecurityquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ColinM123
    wrote on last edited by
    #1

    Hi folks, I've being starting out on WCF, I made a service and uploaded to my shared hosting.(after a bit of fiddling with configs, switching off security) I then navigate to the service.svc and it shows the metadata page. I run svcutil [address] and get a proxy class which I can consume through my console program. It all works fine I can add two numbers together! However... I try it in Silverlight this time adding a service reference, now when I instatiate the reference I get a KeyNotFoundException. What are the differences I need to be aware of when use a WCF service from silverlight?

    P 1 Reply Last reply
    0
    • C ColinM123

      Hi folks, I've being starting out on WCF, I made a service and uploaded to my shared hosting.(after a bit of fiddling with configs, switching off security) I then navigate to the service.svc and it shows the metadata page. I run svcutil [address] and get a proxy class which I can consume through my console program. It all works fine I can add two numbers together! However... I try it in Silverlight this time adding a service reference, now when I instatiate the reference I get a KeyNotFoundException. What are the differences I need to be aware of when use a WCF service from silverlight?

      P Offline
      P Offline
      Peter Brennen
      wrote on last edited by
      #2

      Hi Colin, This problem was driving me mad on Friday so I thought I would let you know the answer :) What you need to do is open the ServiceReferences.ClientConfig file in your Silverlight application that contains the client Service Reference. When I did this, I noticed it only contained an empty tag . What I then did was open the Web.config file in my host web application project (that contains the Web Service to be consumed). Locate the entry at the bottom for the service you are trying to expose to the Silverlight app. Change the binding attribute to "basicHttpBinding". Save the file. Switch back to the ServiceReferences.ClientConfig file we opened earlier, in Solution Explorer, under Service References folder right click the service reference and select "Update Service Refeernce". You will notice that the config file is now populated correctly and you should be able to use the service now. The default binding appears to be wsHttpBinding which for some reason does not generate any code in the ServiceReferences.ClientConfig file. See if that works :doh: Peter

      C 1 Reply Last reply
      0
      • P Peter Brennen

        Hi Colin, This problem was driving me mad on Friday so I thought I would let you know the answer :) What you need to do is open the ServiceReferences.ClientConfig file in your Silverlight application that contains the client Service Reference. When I did this, I noticed it only contained an empty tag . What I then did was open the Web.config file in my host web application project (that contains the Web Service to be consumed). Locate the entry at the bottom for the service you are trying to expose to the Silverlight app. Change the binding attribute to "basicHttpBinding". Save the file. Switch back to the ServiceReferences.ClientConfig file we opened earlier, in Solution Explorer, under Service References folder right click the service reference and select "Update Service Refeernce". You will notice that the config file is now populated correctly and you should be able to use the service now. The default binding appears to be wsHttpBinding which for some reason does not generate any code in the ServiceReferences.ClientConfig file. See if that works :doh: Peter

        C Offline
        C Offline
        ColinM123
        wrote on last edited by
        #3

        Yeah, that was problem number one, change to basicHttpBinding (case sensitive, I think) Unfortunately what I was trying to do in the webservice didn't work as it needed to be called from the main thread synchronously, and Silverlight only allows asynch. I was trying to save an image by posting back the XAML and using the webservice to create an image, but couldn't find a way to get it to work, ah well, nevermind, back to a desktop program.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups