我有一个 Silverlight 应用程序,它通过 WCF 服务与服务器端的 ADO.Net 数据实体进行通信。实际上,我使用多个 WCF 服务与三个不同的数据 ADO.Net 数据实体进行通信。我最初在 Visual Studio 2010 上构建了这个项目,最近大约一周前转移到了 Visual Studio Professional 2012(试用版)。最初一切正常/移植良好,直到大约一个小时前我对服务没有任何问题。不到一个小时前,我实际上在我的代码中使用了这些相同的 WCF 服务。但是,当我添加一种将 xml 字符串插入数据库的方法时,我收到了这个错误:
Content Type text/xml; charset=utf-8 was not supported by service . The client and service bindings may be mismatched.
但是我检查了绑定,据我从 ServiceReferences.ClientConfig 文件中可以看出,它们是 basicHttpBinding。我四处寻找解决方案,我能找到的唯一一个建议删除服务引用并在重新启动 Visual Studio 后阅读它,所以我终于尝试了,但是现在,即使删除了我添加的方法,我现在在我尝试在客户端上添加服务引用:
Warning 6 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Exception has been thrown by the target of an invocation.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IXMonitorXMLDataService'] C:\Users\ckarrs\Documents\Visual Studio 11\Projects\SL_xMonitor_Frontend_RefactorV1_Backup82212\SL_xMonitor_Frontend_RefactorV1\Service References\XMonitorXMLDataService\Reference.svcmap 1 1 SL_xMonitor_Frontend_RefactorV1
Warning 7 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://tempuri.org/']/wsdl:portType[@name='IXMonitorXMLDataService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IXMonitorXMLDataService'] C:\Users\ckarrs\Documents\Visual Studio 11\Projects\SL_xMonitor_Frontend_RefactorV1_Backup82212\SL_xMonitor_Frontend_RefactorV1\Service References\XMonitorXMLDataService\Reference.svcmap 1 1 SL_xMonitor_Frontend_RefactorV1
Warning 8 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='BasicHttpBinding_IXMonitorXMLDataService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='XMonitorXMLDataService']/wsdl:port[@name='BasicHttpBinding_IXMonitorXMLDataService'] C:\Users\ckarrs\Documents\Visual Studio 11\Projects\SL_xMonitor_Frontend_RefactorV1_Backup82212\SL_xMonitor_Frontend_RefactorV1\Service References\XMonitorXMLDataService\Reference.svcmap 1 1 SL_xMonitor_Frontend_RefactorV1
Warning 9 Custom tool warning: No endpoints compatible with Silverlight 5 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. C:\Users\ckarrs\Documents\Visual Studio 11\Projects\SL_xMonitor_Frontend_RefactorV1_Backup82212\SL_xMonitor_Frontend_RefactorV1\Service References\XMonitorXMLDataService\Reference.svcmap 1 1 SL_xMonitor_Frontend_RefactorV1
Warning 10 Custom tool warning: Exception has been thrown by the target of an invocation. C:\Users\ckarrs\Documents\Visual Studio 11\Projects\SL_xMonitor_Frontend_RefactorV1_Backup82212\SL_xMonitor_Frontend_RefactorV1\Service References\XMonitorXMLDataService\Reference.svcmap 1 1 SL_xMonitor_Frontend_RefactorV1
我感到很困惑。其他服务引用保持不变,并且该服务完全正常工作,直到我尝试添加并更新引用。这是 VS 2010 和 2012 之间的兼容性问题吗?MSDN 网站称 VS 2012 向后兼容 VS 2010,一切似乎都可以正常迁移。非常感谢任何帮助,我很困惑。如果需要其他信息,请告诉我。