Craig S
Craig S

Reputation: 241

Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference

When trying to use .net core 2.1 rc1 to add a service reference for WCF, I am experiencing the following error:

Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference

I have checked and the only security in place is Transport, no message security.

The logs are as follows:

[05/24/2018 12:28:28],59,Importing web service metadata ...

[05/24/2018 12:28:28],27,Number of service endpoints found: 2

[05/24/2018 12:28:28],9,Scaffolding service reference code ...

[05/24/2018 12:28:28],71,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
 "dotnet new console --no-restore --force --type project --language C# --output . --name svcutil_starter"

[05/24/2018 12:28:30],9,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
 "dotnet restore --ignore-failed-sources"

[05/24/2018 12:28:31],35,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
 "dotnet "svcutil" --additionalprobingpath "C:\Users\me\\.nuget\packages" "C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\SvcUtilParams.txt""

[05/24/2018 12:28:32],52,An unknown error occurred while invoking the service metadata component.
Failed to generate service reference.

[05/24/2018 12:28:32],11,Done.

Upvotes: 13

Views: 4368

Answers (4)

Tomex Ou
Tomex Ou

Reputation: 99

Till 2018-07-31, it still has problems for NET Core 2.1.x to add a service reference for WCF in VS2017 (v15.7.5). You can create Net 2.0.x project to create the connected service, it'll work perfect. Then copy the 'Connected Services' sub-directory in project to new NET core v2.1.x project.

Installs the following packages via NuGet such as this image:

NuGet Packages for Connected Services enter image description here

Compiled successfully in NET Core 2.1.x project.

Upvotes: 5

Yuma
Yuma

Reputation: 21

Not sure why this worked for me:

  • Created second Temp new project targeted to .Net Core 2.0 (in another instance of VS)
  • Make service reference call (Microsoft WCF Web Service Reference Provider) with .wsdl uri
  • Open 1st project (target project targetted to .Net Core 2.1) and add the service reference the same way.

Not sure why this worked. Without creating the second solution in a different instance of Visual Studio, it was not working.

Hope this helps.

Upvotes: 2

Craig S
Craig S

Reputation: 241

As a temporary solution to this issue I have added a new Project to my solution, set it to Asp Core 1.1 and added the connected service that way which appears to work.

It would seem 2.1 is broken currently and I'll have to wait for updates before doing it directly in my Project.

Edit: Thanks to User3130628. This has now been fixed and appears to be working, even in VS 15.7.5.

I suspect the Core framework has been updated and this has corrected the issue.

Upvotes: 11

user3130628
user3130628

Reputation: 517

As of today VS2017 15.8.1 it seems to be working again with .Net core 2.1.401

Upvotes: 4

Related Questions