取消后添加WCF服务失败

时间:2017-08-24 15:57:19

标签: visual-studio-2017

我试图添加一个WCF服务,我忘了在点击完成之前更改类名,所以我在导入过程的前几个步骤中取消了它。我再次尝试使用正确的名称,现在我收到以下错误。

[8/24/2017 11:53:41.664 AM] Adding Microsoft WCF Web Service Reference Provider - Preview to the project.
[8/24/2017 11:53:41.674 AM] Importing web service metadata ...
[8/24/2017 11:53:41.750 AM] Number of services found: 2
[8/24/2017 11:53:41.768 AM] Restoring NuGet packages ...
[8/24/2017 11:53:43.905 AM] Error:Unable to restore NuGet packages, please ensure packages can be restored for the project.
[8/24/2017 11:53:44.013 AM] Failed adding Microsoft WCF Web Service Reference Provider - Preview to the project.

我尝试重新安装WCF提供程序,重新启动,似乎没有任何帮助。我在哪里可以找到更详细的日志,说明为什么会这样? VS Pro 2017 15.3.1,.net core 2.0 web项目

2 个答案:

答案 0 :(得分:0)

任何有兴趣的人,https://github.com/dotnet/wcf/issues/2228 似乎从net core 1.1升级到2.0会导致dotnet恢复过程失败,因为你必须从csproj中删除PackageTargetFallback

答案 1 :(得分:0)

解决方法

由于添加Microsoft WCF Web Service Reference不适用于[ { id:1 name:"user1" }, { id:2 name:"user2" } ] 项目at the moment,您可以添加针对ASP.NET Core 2.1的新.NET Standard类库项目,并添加服务引用它:

  • 右键点击项目
  • 选择Standard 2.0 - > Add
  • Connected Service窗口中选择Connected Services
  • guide
  • 所述指定Microsoft WCF Web Service Reference Provider详细信息
  • 向您的WSDL网络应用程序添加新的库引用 (针对ASP.NET Core