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. .NET (Core and Framework)
  4. Unable to load proxy class at runtime when using "Add Web Reference..."

Unable to load proxy class at runtime when using "Add Web Reference..."

Scheduled Pinned Locked Moved .NET (Core and Framework)
announcementcsharpvisual-studiowcfsysadmin
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.
  • B Offline
    B Offline
    bwilhite
    wrote on last edited by
    #1

    Hi, I have a web service I created and uploaded to my server. In another project (output type .dll) I added a reference to the service via "Add Web Reference..." dialog. All seemed fine at first. A file called Reference.cs is added under the web reference node, and when I look at it, this looks just like the proxy class that is needed. The Build Action associated with this file is "Compile." I am also able to use intellisense to get access to the created proxy class, and when I load the .dll from another project in the same solution through the debugger, everything works fine. However, when I copy the files from my bin\Release\ to another folder (and also calling the .dll from a separate solution altogether), I get an exception : "System.TypeLoadException: Could not load type 'Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc' from assembly 'SBJCharts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..." (where Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc is the proxy class) The other part of all of this, is that if I generate the proxy class via wsdl.exe and add the output to my project...at that point all works as expected (after I also remove the WebReference). I'd really like to figure out what's going on here, as it would be much simpler just to add the WebReference and then everything works as expected. Thanks in advance. BW

    L 1 Reply Last reply
    0
    • B bwilhite

      Hi, I have a web service I created and uploaded to my server. In another project (output type .dll) I added a reference to the service via "Add Web Reference..." dialog. All seemed fine at first. A file called Reference.cs is added under the web reference node, and when I look at it, this looks just like the proxy class that is needed. The Build Action associated with this file is "Compile." I am also able to use intellisense to get access to the created proxy class, and when I load the .dll from another project in the same solution through the debugger, everything works fine. However, when I copy the files from my bin\Release\ to another folder (and also calling the .dll from a separate solution altogether), I get an exception : "System.TypeLoadException: Could not load type 'Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc' from assembly 'SBJCharts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..." (where Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc is the proxy class) The other part of all of this, is that if I generate the proxy class via wsdl.exe and add the output to my project...at that point all works as expected (after I also remove the WebReference). I'd really like to figure out what's going on here, as it would be much simpler just to add the WebReference and then everything works as expected. Thanks in advance. BW

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      I've never created a proxy that way. The way I have done it successfully is to run the WSDL command line tool to generate a CSharp file containing the proxy class. I then add this file to a Class Library ( Assembly ) project. The resulting assembly can be added as a reference to any number of projects and used assuming you account for any changes is the address ( URI ) to the hosted Web Service.

      led mike

      B 1 Reply Last reply
      0
      • L led mike

        I've never created a proxy that way. The way I have done it successfully is to run the WSDL command line tool to generate a CSharp file containing the proxy class. I then add this file to a Class Library ( Assembly ) project. The resulting assembly can be added as a reference to any number of projects and used assuming you account for any changes is the address ( URI ) to the hosted Web Service.

        led mike

        B Offline
        B Offline
        bwilhite
        wrote on last edited by
        #3

        This would work fine too...only thing is I'd have to re-run wsdl if I added another method to the web service. It' really just a few more steps, but it would be nice to avoid them if I could. If I ever dig anything up on why it's not working as expected, I'll be sure to post the solution to this thread.

        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