使用Epplus和Service.svc时出现问题

时间:2012-12-11 12:39:05

标签: asp.net web-services wsdl epplus

我有一个带有Service.svc文件的网站,我使用Add New Item创建了这个 - >支持AJAX的WCF服务,几周以来一切正常。 今天,我导入了EPplus.dll来生成一些excel文件。当我尝试编译我得到这个错误

Error   1   Reference.svcmap: 
Failed to generate code for the service reference 'QUAY.Tractebel.COP.Servicos'.
Cannot import wsdl:portType  Detail: An exception was thrown while running a WSDL import extension:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Type 'OfficeOpenXml.ExcelRangeBase' is a recursive collection data contract which is not supported. 
Consider modifying the definition of collection 'OfficeOpenXml.ExcelRangeBase' to remove references to itself.  
XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='Servicos']  App_WebReferences/QUAY/Tractebel/COP/Servicos/  

我不知道如何解决它,有人可以帮助我吗?

1 个答案:

答案 0 :(得分:3)

在引用我使用的自定义wcf类时遇到了同样的问题。 奇怪的问题是,在我的旧开发电脑(Windows Vista 32bit,visual studio 2010)上我没有遇到这个问题,它只会弹出我的新系统(Windows 8 64位)。 呸。

然而,我绕过了打开App_WebReferences的问题 - > “您的服务名称” - >右键单击依赖Refrence图标 - > “配置服务参考”

在此屏幕中,将选项按钮从“在所有引用的组件中重用类型”移动到“重用指定组件中的类型”并检查所有依赖库除了EPPlus

编译并......瞧

如果某人也有逻辑解释,我会很乐意听