1

I want to have a web service developed in a solution in visual web developer, call another web service in the same solution, and I found that I am able to add the web reference by "searching in the solution" however I am concerned that it may not work correctly upon publication, as it points to an odd port that I assume to be associated with the debug mode in VWD (54153)

Does any one know if that will work correctly, or if I would need to publish locally on the development machine and create a reference to localhost, such that upon actual publication to the production server that it would work correctly.

Regards Martin

marts
  • 79
  • 8

1 Answers1

0

You are right in that you can't add a reference that way. A web reference is a very different thing than a standard .dll or project reference.

You need to publish the web service somewhere (even on localhost) and add a web reference following these instructions.

David
  • 72,686
  • 18
  • 132
  • 173
  • While this worked for localhost applications, when I publish this out to the production server, it fails. I think that the problem is that the web reference, whilst pointing to localhost, would still need to be "refreshed" for the alternative server. Is there a way to dynamically instantiate a web reference beyond adding it to the solution (I realize that intelisense would not work, as it would not know the definition of the service method). Thanks – marts Aug 21 '12 at 14:02
  • You need to do a fond and replace in your project to update the URL everywhere it exists. That'll include the web.config, the ,disco files, etc. I find it's a heck of a lot easier NOT to add the reference to localhost, but rather, to publish the web service FIRST, then on your local machine, add the reference to the live location from the project that needs to reference it. The whole "Add Service Reference" is based on the premise that the web service you're calling may be on another company's server, so it's just easier to view your web service as distinct from the calling app. – David Aug 21 '12 at 15:22
  • Actually, if you've got the web service published live now, it might be easier, from your standpoint, to remove the existing web reference and re-add it, but pointing to the live locaiton now. (Be sure the name is the same, caoitalization matters if you're in C# of course.) – David Aug 21 '12 at 15:31
  • Thanks for all the replies. I found the reason that my remote server was not working was actually an IIS configuration error. It turns out that using localhost inside the webservice to kind of self call other services in the same group works well. – marts Aug 21 '12 at 19:34