代理类不适用于Windows Phone 7对WCF服务的引用

时间:2011-05-26 03:40:34

标签: wcf windows-phone-7

我有一个可用的现有WCF服务。我在Visual Studio 2010中为我的Windows Phone应用程序添加了一个引用。参考显示,我看到了检查它的属性时的方法。该服务使用basicHttpBinding。似乎从未生成代理类。我无法引用它(是的 - 我正在检查正确的命名空间)

我知道SlSvcUtil.exe实用程序 - 但这应该不再需要了。有关为什么我的代理类没有被生成但是服务引用在那里的任何想法?

谢谢!

编辑:Wsdl文件如下:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProjectManager" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://tempuri.org/Imports">
      <xsd:import schemaLocation="http://somesite/ProjectManager/ProjectManager.svc?xsd=xsd0" namespace="http://tempuri.org/" />
      <xsd:import schemaLocation="http://somesite/ProjectManager/ProjectManager.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
      <xsd:import schemaLocation="http://somesite/ProjectManager/ProjectManager.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ProjectManager" />
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="IProjectManagerService_GetProjectList_InputMessage">
    <wsdl:part name="parameters" element="tns:GetProjectList" />
  </wsdl:message>
  <wsdl:message name="IProjectManagerService_GetProjectList_OutputMessage">
    <wsdl:part name="parameters" element="tns:GetProjectListResponse" />
  </wsdl:message>
  <wsdl:message name="IProjectManagerService_GetProjectFiles_InputMessage">
    <wsdl:part name="parameters" element="tns:GetProjectFiles" />
  </wsdl:message>
  <wsdl:message name="IProjectManagerService_GetProjectFiles_OutputMessage">
    <wsdl:part name="parameters" element="tns:GetProjectFilesResponse" />
  </wsdl:message>
  <wsdl:portType name="IProjectManagerService">
    <wsdl:operation name="GetProjectList">
      <wsdl:input wsaw:Action="http://tempuri.org/IProjectManagerService/GetProjectList" message="tns:IProjectManagerService_GetProjectList_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/IProjectManagerService/GetProjectListResponse" message="tns:IProjectManagerService_GetProjectList_OutputMessage" />
    </wsdl:operation>
    <wsdl:operation name="GetProjectFiles">
      <wsdl:input wsaw:Action="http://tempuri.org/IProjectManagerService/GetProjectFiles" message="tns:IProjectManagerService_GetProjectFiles_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/IProjectManagerService/GetProjectFilesResponse" message="tns:IProjectManagerService_GetProjectFiles_OutputMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BasicHttpBinding_IProjectManagerService" type="tns:IProjectManagerService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetProjectList">
      <soap:operation soapAction="http://tempuri.org/IProjectManagerService/GetProjectList" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetProjectFiles">
      <soap:operation soapAction="http://tempuri.org/IProjectManagerService/GetProjectFiles" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ProjectManager">
    <wsdl:port name="BasicHttpBinding_IProjectManagerService" binding="tns:BasicHttpBinding_IProjectManagerService">
      <soap:address location="http://somesite/ProjectManager/ProjectManager.svc" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

4 个答案:

答案 0 :(得分:2)

这发生在我身上。

不确定是什么原因造成的。

对我有用的是关闭Visual Studio,重新打开,右键单击该服务,然后单击“更新服务参考”。

答案 1 :(得分:2)

我遇到了完全相同的问题。安装“Windows Phone Developer Tools Fix”解决了这个问题。

以下是修补程序的下载链接:http://download.microsoft.com/download/6/D/6/6D66958D-891B-4C0E-BC32-2DFC41917B11/VS10-KB2486994-x86.exe

祝你好运!

答案 2 :(得分:1)

我遇到了这个问题 再次使用其他名称添加服务为我解决了一两次问题 Slsvc每次都可以工作,并且在检查TFS时可以更好地工作。 不确定这是否与TFS有关。

答案 3 :(得分:1)

奇怪的是 - 一个月后,它开始没有其他安装工作。它可能是最近重新启动'固定'它,但我认为我之前已经重新启动了 - 但谁知道呢。无论哪种方式,它的工作。