无法为服务引用生成代码

无法为服务引用生成代码

本文介绍了服务引用错误:无法为服务引用生成代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Windows 服务解决方案,正在尝试在 VS2010 中添加对 Hermes(开源 ebms 消息服务器)Web 服务的服务引用.

I have a Windows Service Solution and am trying to add a service reference to a Hermes(Opensource ebms message server) Web Service in VS2010.

我可以使用它的 URL 找到 Web 服务,但是当我尝试填充服务引用时,我在 Visual Studio 中收到以下错误:

I can find the Web Service using it's URL, but when I try and populate the Service reference I get the following errors in Visual Studio:

Error 8 Custom tool error: Failed to generate code for the service reference 'testService'.  Please check other error and warning messages for details. C:UsersAdmindocumentsvisual studio 2010ProjectsMyProjectMyProject.MessageHandlerService References	estServiceReference.svcmap 1 1 MyProject.MessageHandler


Warning 6 Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[@name='EbmsStatusQuery']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[@name='EbmsSoapHttpStatusQuery'] C:UsersAdmindocumentsvisual studio 2010ProjectsMyProjectMyProject.MessageHandlerService References	estServiceReference.svcmap 1 1 MyProject.MessageHandler

Warning 7 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[@name='EbmsSoapHttpStatusQuery']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:service[@name='EbmsMessageStatusQuery']/wsdl:port[@name='EbmsStatusQuery'] C:UsersAdmindocumentsvisual studio 2010ProjectsMyProjectMyProject.MessageHandlerService References	estServiceReference.svcmap 1 1 MyProject.MessageHandler

Warning 5 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://service.ebms.edi.cecid.hku.hk/' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[@name='EbmsStatusQuery'] C:UsersAdmindocumentsvisual studio 2010ProjectsMyProjectMyProject.MessageHandlerService References	estServiceReference.svcmap 1 1 MyProject.MessageHandler

一些调查似乎表明这是由于 svcutil.exe 由于没有目录(可能是 c:windowsemp)的权限而无法构建代理.我尝试分配各种访问权限,但我不确定哪个用户需要该权限,或者是否只是一个红鲱鱼.

Some investigation seemed to suggest it is due to svcutil.exe not been able to build the proxys due to not having permissions to a directory (possibly c:windowsemp). I have tried assigning various access permissions, but I am not really sure which user needs the permission, or if it is just a red herring.

任何想法将不胜感激.

谢谢

推荐答案

必须从配置服务引用选项中取消选中所有引用程序集中的重用类型

Have to uncheck the Reuse types in all referenced assemblies from Configure service reference option

查看详情

这篇关于服务引用错误:无法为服务引用生成代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 09:54