【发布时间】:2011-06-03 05:26:08
【问题描述】:
我已经为我正在开发的 Silverlight 4.0 解决方案创建了一个 LINQ to SQL 类和一个启用 Silverlight 的 WCF 服务。我正在将其发布到本地 IIS7 服务器,而不是在 Visual Studio 临时 Web 服务器中运行。每当我使用在临时 Web 服务器上运行的服务构建项目时,它都可以正常工作,但是一旦将其移动到我的 IIS7 Web 服务器,它就会失败并出现以下错误:
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace '' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 2 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='']/wsdl:portType[@name='SpaceGameDBService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 3 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://tempuri.org/']/wsdl:binding[@name='CustomBinding_SpaceGameDBService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='SpaceGameDBService']/wsdl:port[@name='CustomBinding_SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 4 Custom tool warning: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 5 Custom tool warning: Exception has been thrown by the target of an invocation. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Error 6 Custom tool error: Failed to generate code for the service reference 'DBServiceReference'. Please check other error and warning messages for details. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
现在,我认为警告 4 和 5 以及错误 6 是警告 1、2 和 3 的结果,所以我暂时忽略了它们。我一直在谷歌搜索,看到建议告诉我在将服务引用添加到主 Silverlight 项目时取消选中“在引用的程序集中重用类型”复选框,但这根本没有解决我的问题。我也尝试过重新启动 Visual Studio,但这也没有解决任何问题。我已经开始考虑这是 IIS7 Web 服务器中的某种设置,我错过了,但我环顾了几个小时,决定来这里寻求帮助。我发现了一个类似的问题here,但“解决方案”是不解决问题,而是另辟蹊径。我希望这次我们能找到解决方案。
【问题讨论】:
-
我发现一个公共服务给出的错误与我自己的服务给我的错误完全相同。我认为这可能有助于任何人重现问题,以便更容易地确定他们是否能找到解决方案。它位于:api.affiliatewindow.com/v3/MerchantService.wsdl
-
我发现重现问题的最短方法是启动 Visual Studio 命令提示符,然后键入以下命令:“svcutil api.affiliatewindow.com/v3/MerchantService.wsdl”。这似乎表明服务器有问题,或者 svcutil 做错了什么。
标签: web-services linq-to-sql visual-studio-2010 iis-7 silverlight-4.0