Web services svcutil在IIS7服务器上失败,但在Visual Studio 2010临时web服务器上失败

Web services svcutil在IIS7服务器上失败,但在Visual Studio 2010临时web服务器上失败,web-services,linq-to-sql,visual-studio-2010,iis-7,silverlight-4.0,Web Services,Linq To Sql,Visual Studio 2010,Iis 7,Silverlight 4.0,我已经为正在开发的Silverlight 4.0解决方案创建了一个LINQ to SQL类和一个支持Silverlight的WCF服务。我正在将其发布到本地IIS7服务器,而不是在VisualStudio临时web服务器中运行。每当我使用在临时web服务器上运行的服务构建项目时,它都可以正常工作,但一旦我将其移动到IIS7 web服务器,它就会失败,并出现以下错误: Warning 1 Custom tool warning: Cannot import wsdl:portType Deta

我已经为正在开发的Silverlight 4.0解决方案创建了一个LINQ to SQL类和一个支持Silverlight的WCF服务。我正在将其发布到本地IIS7服务器,而不是在VisualStudio临时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项目时取消选中“在引用的程序集中重用类型”复选框,但是这根本没有解决我的问题。我也尝试重新启动VisualStudio,但这也没有解决任何问题。我开始考虑这是iS7 Web服务器中的一种设置,我错过了,但我四处看了好几个小时,决定来这里寻求帮助。我发现了一个类似的问题,但“解决方案”不是解决问题,而是找到另一种方法。我希望这次我们能找到一个解决方案。

结果是,当我创建解决方案时,我忘了勾选“启用WCF RIA服务”。除此之外,我还从头开始重新编辑了web.config。这在开发服务器上是如何工作的对我来说是一个谜,但是这两件事都解决了问题。

我发现一个公共服务的错误与我自己的服务的错误完全相同。我想这可能会帮助任何人重现问题,以便更容易地找出他们是否能找到解决方案。它位于这里:我发现重现问题的最短方法是启动visualstudio命令Promt,然后键入以下命令:“svcutil”。这似乎表明服务器有问题,或者svcutil有问题。