2013-07-11 15 views
1

我創建了一個非常簡單的WF4服務,其中只包含接收/發送序列。我已經部署到AppFabric,它通過瀏覽器查看時的響應如預期(即「您已創建服務」... wsdl鏈接..等)爲WF4工作流服務添加服務引用不會創建客戶端(ClientBase)

我在VS2012中添加了服務引用,它成功完成。但是,沒有引用ClientBase類(ServiceClient)。

但是,如果不是添加服務引用創建通過

svcutil.exe http://localhost/TrinityServices/Testbed/Service2.xamlx?wsdl 

產生的Service2.cs顯然擁有ServiceClient宣佈服務2類,

[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 
public partial class ServiceClient : System.ServiceModel.ClientBase<IService>, IService 

,我能聲明:

var svc = new ServiceClient(); 
. 
. 
string p = svc.GetData(); 

爲什麼客戶端類沒有通過服務引用生成過程?以下是完整的wsdl。

我碰到過一個類似的帖子(ClientBase classes are not available in Reference.cs file),但我看不到與我的問題有直接關係。我的名字空間不受默認值的影響。

感謝您的閱讀!

<?xml version="1.0" ?> 
<wsdl:definitions name="Service2" targetNamespace="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <wsp:Policy wsu:Id="NetNamedPipeBinding_IService_policy"> 
    <wsp:ExactlyOne> 
     <wsp:All> 
     <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"/> 
     <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> 
      <wsp:Policy> 
      <sp:TransportToken> 
       <wsp:Policy> 
       <msf:WindowsTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy"> 
        <msf:ProtectionLevel> 
        EncryptAndSign 
        </msf:ProtectionLevel> 
       </msf:WindowsTransportSecurity> 
       </wsp:Policy> 
      </sp:TransportToken> 
      <sp:AlgorithmSuite> 
       <wsp:Policy> 
       <sp:Basic256/> 
       </wsp:Policy> 
      </sp:AlgorithmSuite> 
      <sp:Layout> 
       <wsp:Policy> 
       <sp:Strict/> 
       </wsp:Policy> 
      </sp:Layout> 
      </wsp:Policy> 
     </sp:TransportBinding> 
     <wsaw:UsingAddressing/> 
     </wsp:All> 
    </wsp:ExactlyOne> 
    </wsp:Policy> 
    <wsdl:types> 
    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
     <xs:element name="anyType" nillable="true" type="xs:anyType"/> 
     <xs:element name="anyURI" nillable="true" type="xs:anyURI"/> 
     <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/> 
     <xs:element name="boolean" nillable="true" type="xs:boolean"/> 
     <xs:element name="byte" nillable="true" type="xs:byte"/> 
     <xs:element name="dateTime" nillable="true" type="xs:dateTime"/> 
     <xs:element name="decimal" nillable="true" type="xs:decimal"/> 
     <xs:element name="double" nillable="true" type="xs:double"/> 
     <xs:element name="float" nillable="true" type="xs:float"/> 
     <xs:element name="int" nillable="true" type="xs:int"/> 
     <xs:element name="long" nillable="true" type="xs:long"/> 
     <xs:element name="QName" nillable="true" type="xs:QName"/> 
     <xs:element name="short" nillable="true" type="xs:short"/> 
     <xs:element name="string" nillable="true" type="xs:string"/> 
     <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/> 
     <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/> 
     <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/> 
     <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/> 
     <xs:element name="char" nillable="true" type="tns:char"/> 
     <xs:simpleType name="char"> 
     <xs:restriction base="xs:int"/> 
     </xs:simpleType> 
     <xs:element name="duration" nillable="true" type="tns:duration"/> 
     <xs:simpleType name="duration"> 
     <xs:restriction base="xs:duration"> 
      <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/> 
      <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/> 
      <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/> 
     </xs:restriction> 
     </xs:simpleType> 
     <xs:element name="guid" nillable="true" type="tns:guid"/> 
     <xs:simpleType name="guid"> 
     <xs:restriction base="xs:string"> 
      <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/> 
     </xs:restriction> 
     </xs:simpleType> 
     <xs:attribute name="FactoryType" type="xs:QName"/> 
     <xs:attribute name="Id" type="xs:ID"/> 
     <xs:attribute name="Ref" type="xs:IDREF"/> 
    </xs:schema> 
    </wsdl:types> 
    <wsdl:message name="IService_GetData_InputMessage"> 
    <wsdl:part element="q1:int" name="int" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/"/> 
    </wsdl:message> 
    <wsdl:message name="IService_GetData_OutputMessage"> 
    <wsdl:part element="q2:string" name="string" xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/"/> 
    </wsdl:message> 
    <wsdl:portType name="IService"> 
    <wsdl:operation name="GetData"> 
     <wsdl:input message="tns:IService_GetData_InputMessage" wsaw:Action="http://tempuri.org/IService/GetData"/> 
     <wsdl:output message="tns:IService_GetData_OutputMessage" wsaw:Action="http://tempuri.org/IService/GetDataResponse"/> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="BasicHttpBinding_IService" type="tns:IService"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="GetData"> 
     <soap:operation soapAction="http://tempuri.org/IService/GetData" style="document"/> 
     <wsdl:input> 
     <soap:body use="literal"/> 
     </wsdl:input> 
     <wsdl:output> 
     <soap:body use="literal"/> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:binding name="NetNamedPipeBinding_IService" type="tns:IService"> 
    <wsp:PolicyReference URI="#NetNamedPipeBinding_IService_policy"/> 
    <soap12:binding transport="http://schemas.microsoft.com/soap/named-pipe"/> 
    <wsdl:operation name="GetData"> 
     <soap12:operation soapAction="http://tempuri.org/IService/GetData" style="document"/> 
     <wsdl:input> 
     <soap12:body use="literal"/> 
     </wsdl:input> 
     <wsdl:output> 
     <soap12:body use="literal"/> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="Service2"> 
    <wsdl:port binding="tns:BasicHttpBinding_IService" name="BasicHttpBinding_IService"> 
     <soap:address location="http://localhost/TrinityServices/Testbed/Service2.xamlx"/> 
    </wsdl:port> 
    <wsdl:port binding="tns:NetNamedPipeBinding_IService" name="NetNamedPipeBinding_IService"> 
     <soap12:address location="net.pipe://ip-0a7e0a82/TrinityServices/Testbed/Service2.xamlx"/> 
     <wsa10:EndpointReference> 
     <wsa10:Address> 
      net.pipe://ip-0a7e0a82/TrinityServices/Testbed/Service2.xamlx 
     </wsa10:Address> 
     <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity"> 
      <Spn> 
      host/ip-0A7E0A82 
      </Spn> 
     </Identity> 
     </wsa10:EndpointReference> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

回答

0

任何人被發現在這其中,這裏的問題。我爲控制檯服務應用程序生成了Web引用。默認情況下,這些實現爲工作流活動,而不是作爲客戶端封裝的一部分。一旦我意識到我的誤解,實例化很簡單。