20

I have two Web Project.

First of them is created about 2-3 weeks ago. Second of them is created today.

I want to add Web Reference to the second web project.

First old Project Solution View

First old Project Solution View

Second new Project Solution View

enter image description here

In new Project I can't find how to add Web Reference. I can add Service Reference but I don't need it.

From here I can add Service Reference

enter image description here

but I can't add Web Reference Like it was in old project

enter image description here

From where I should add Web Reference? Is there any changes regarding web references?

  • please check this link: https://marketplace.visualstudio.com/items?itemName=WCFCORETEAM.VisualStudioWCFConnectedService – pisi1001 Aug 11 '17 at 12:51
  • I already installed it, So i can add Service Reference. – Lukino Grdzelishvili Aug 11 '17 at 13:05
  • Yes, you can add classic web service to your .core project. – pisi1001 Aug 11 '17 at 13:16
  • I am getting this error _The service at the following URI does not have any endpoints compatible with .Net Core apps:'C:\Users\Luka\Desktop\Service.wsdl'_ I was getting this also, in old project, while adding as Service Reference. but i added as Web Reference without this problem. – Lukino Grdzelishvili Aug 11 '17 at 13:34
  • @LukinoGrdzelishvili .Net core WCF client support BasiHttpBinding only. – agua from mars Aug 11 '17 at 16:30
  • I used my old project in my new solution, and it works fine. – Lukino Grdzelishvili Aug 14 '17 at 08:08
  • What is the project type you can't add reference to `WCF`? If it is an `ASP.NET Core` application you can do that via intermediary `Standard` class library. See the details here https://stackoverflow.com/a/50624568/804385 – Dmitry Pavlov Dec 29 '18 at 12:23
  • It is core 2.0. I have made it using old Web Api project and .net core app uses it like rest api. – Lukino Grdzelishvili Jan 11 '19 at 11:30
  • Possible duplicate of [Web Reference vs. Service Reference](https://stackoverflow.com/questions/2158106/web-reference-vs-service-reference) – Dmitry Pavlov Feb 03 '19 at 19:52
  • @DmitryPavlov I asked this question for .Net Core. if you see your linked question is 9 years old and .net core isn't as old as that question. so that question can't be useful for .net core. – Lukino Grdzelishvili Feb 07 '19 at 10:19
  • @LukinoGrdzelishvili `Web Reference` (as it was in the past) doesn't exist anymore for `.NET Core` projects. Did you try using `Add Connected Serrvice` -> `Microsfot WCF Web Service Reference Provider` and provide your `WSDL` link to re-generate proxy class for your web reference? – Dmitry Pavlov Feb 07 '19 at 17:51
  • @DmitryPavlov Yes, I tried it. but that service is old, and i think they used different endpoint configuration from .net core support. I am gettubg error: "The service at the following URI does not have any endpoints compatible with .Net Core apps:'C:\Users\Luka\Desktop\Service.wsdl' ". I made .net framework web api project and included this wsdl using it. – Lukino Grdzelishvili Feb 11 '19 at 10:53
  • @LukinoGrdzelishvili would you try `Web Services Description Language Tool (Wsdl.exe)` to generate C# code using command line? – Dmitry Pavlov Feb 12 '19 at 15:07

2 Answers2

0

Here's what I would try in a command line:

  • cd "Full path to folder where ConsoleApp1 project lives"
  • dotnet add package "Full path to Test projects .csproj file"

This command should edit your ConsoleApp1.csproj file. Then you can try to build it with:

  • dotnet build
gsvolt
  • 184
  • 8
-1
  • Select old project in Solution Explorer.
  • Click 'Show All Files' button Solution Explorer toolbar.
  • Service node will be expanded and you will see the nested nodes with generated code.
  • You should find the link to WSDL file, which describes your web service.
  • To load a service metadata from a WSDL file, select Browse in Add Web Reference dialog.

Documentation states:

The WCF Web Service Reference tool retrieves metadata from a web service in the current solution, on a network location, or from a WSDL file, and generates a source file containing Windows Communication Foundation (WCF) client proxy code that your .NET app can use to access the web service.

Dmitry Pavlov
  • 30,789
  • 8
  • 97
  • 121
  • This does not add it in a compatible way. – MotKohn Aug 06 '19 at 22:13
  • What do you mean @MotKohn ? – Dmitry Pavlov Aug 07 '19 at 13:46
  • the generated reference.cs even when doing it your prescribed way with loading the file from old project is not usable and does not match at all what the add reference looked like when using .net>Add References>Advanced>Add Web Reference. See https://github.com/dotnet/wcf/issues/3750 – MotKohn Aug 08 '19 at 15:44