How to reference a web service from an ASP.NET MVC project?

I want to add a web service to my ASP.NET MVC 5 project.

I do this by right-clicking on the project in the solution explorer> add > service reference .

Then I add the web service url like this and it creates a new file in the Service References folder called ServiceReference1

Then I can call the web service methods in C # using the ServiceReference1 namespace and VS intellisense works.

The problem is that when I add this web service URL, it adds a new namespace ( ServiceReference2 ) to this folder, but I cannot call the new namespace, and it says ServiceReference2 namespace could not be found .

Am I doing something wrong or is there a problem with the web service?

+6
source share
1 answer

After you open the service window, click the "Advanced" button, as shown below.

In general, I agree that it is better not to use older versions of web services, as I show here, but in real life people have deadlines and the like.

says that although there is no huge drawback to using this technology, as long as performance is not a problem.

enter image description here

Then click "Add Web Link" as shown in the image below.

enter image description here

Then enter the URL and click the small arrow button. Name your link and click "Add Link". see pic below

enter image description here

+11
source

Source: https://habr.com/ru/post/983445/


All Articles