Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net-core

wcf

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.
like image 600
Craig S Avatar asked May 24 '18 12:05

Craig S


2 Answers

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.

like image 118
Yuma Avatar answered Sep 21 '22 07:09

Yuma


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.

like image 38
Tomex Ou Avatar answered Sep 17 '22 07:09

Tomex Ou