.net web service: Can't add service reference, only web reference

后端 未结 5 1214
无人及你
无人及你 2020-12-30 06:26

I have an existing project that consumes web services. One was added as a service reference, and the other as a web reference. I don\'t recall why one was added as a web ref

5条回答
  •  时光取名叫无心
    2020-12-30 06:46

    The Add Service Reference feature is notoriously a pig and is buggy - I use it most of the time, but occasionally I hit problems where the code it generates is either like this (i.e. non-existent) or it doesn't reuse types where it should do.

    You should try using the svcutil command line tool (open a VS Command Prompt to run it), which although it is similar to the reference feature of VS is actually a completely different codebase. You can use that to generate a proxy, all the client-side types etc, just as with the service reference feature.

    Most importantly - it seems to work nearly all the time - so long as the service itself is sane.

提交回复
热议问题