12

我的问题很简单,但不幸的是我无法弄清楚出了什么问题。我已经使用 Razor 语法创建了一个新的 MVC4 Internet 应用程序项目,然后我向该解决方案添加了另一个 WCF 库项目。我没有对这些代码进行任何更改。但是,当我在 MVC 4 应用程序中添加 WCF 项目作为服务引用时,我收到 1 条错误消息和 3 条警告消息:

  1. 错误 4 自定义工具错误:无法为服务引用“ServiceReference1”生成代码。有关详细信息,请查看其他错误和警告消息。c:\users\vendre\documents\visual studio 2012\Projects\MvcApplication3\MvcApplication3\Service References\ServiceReference1\Reference.svcmap 1 1 MvcApplication3
  2. 警告 1 自定义工具警告:无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:无法加载文件或程序集 'DotNetOpenAuth.AspNet,版本 = 4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 或其依赖项之一。该系统找不到指定的文件。
  3. 警告 2 自定义工具警告:无法导入 wsdl:binding 详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。wsdl:portType 的 XPath: //wsdl:definitions[@targetNamespace=' http://tempuri.org/ ']/wsdl:portType[@name='IService1']
  4. 警告 3 自定义工具警告:无法导入 wsdl:port 详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。XPath 到 wsdl:binding: //wsdl:definitions[@targetNamespace=' http://tempuri.org/ ']/wsdl:binding[@name='BasicHttpBinding_IService1']

我读了一些文章,但没有解决我的问题。如果有人知道我的问题的答案,请告诉我。

谢谢。

4

4 回答 4

38

添加参考时,在高级设置中删除重用类型复选框。

于 2013-05-05T07:36:17.773 回答
8

如果您在 2021 年使用 VS2019 遇到此问题。将文件夹添加到名为“Connected Services”的项目中

于 2021-05-05T17:49:04.813 回答
1

sometimes you need to create a folder "Service References" in project path. If you dont have this folder it should gives this path error.

于 2022-02-23T15:25:52.137 回答
1

如果使用 VS 2019,请检查在解决方案资源管理器中是否看到“服务参考”。然后编辑项目文件以进行以下操作

<ItemGroup>
  <WCFMetadata Include="Connected Services\" />
</ItemGroup>
于 2021-07-13T19:31:06.033 回答