简体   繁体   English

WCF自定义绑定-服务响应,客户端不响应

[英]WCF Custom binding - service responds, client doesn't

I have a WCF service that's been working with a wsDualHttpBinding but I'm rewriting it to use a customBinding for greater configurability. 我有一个正在与wsDualHttpBinding一起使用的WCF服务,但我正在重写它以便使用customBinding来实现更大的可配置性。 Here's my service binding: 这是我的服务绑定:

<customBinding>
    <binding name="CodeServiceBinding" openTimeout="00:01:00">
        <transactionFlow transactionProtocol="WSAtomicTransactionOctober2004"/>
        <reliableSession acknowledgementInterval="00:00:00.2" flowControlEnabled="true"
            inactivityTimeout="00:05:00" maxPendingChannels="4" maxRetryCount="8"
            maxTransferWindowSize="8" ordered="true" reliableMessagingVersion="Default" />
        <compositeDuplex/>
        <oneWay maxAcceptedChannels="10">
            <channelPoolSettings idleTimeout="00:02:00" leaseTimeout="00:10:00" maxOutboundChannelsPerEndpoint="10" />
        </oneWay>
        <textMessageEncoding messageVersion="Soap12WSAddressing10"/>
        <httpTransport allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false"
                                        decompressionEnabled="true" keepAliveEnabled="true" manualAddressing="false"
                                        maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxPendingAccepts="0"
                                        maxReceivedMessageSize="2147483647" proxyAuthenticationScheme="Anonymous"
                                        transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                                        useDefaultWebProxy="true" />
    </binding>
</customBinding>

And client binding: 与客户端绑定:

<system.serviceModel xdt:Transform="Replace">
    <bindings>
        <customBinding>
            <binding name="Code.DualEndPoint" openTimeout="00:00:10" sendTimeout="00:00:10">
                <transactionFlow transactionProtocol="WSAtomicTransactionOctober2004"/>
                <reliableSession inactivityTimeout="00:05:00" />
                <compositeDuplex />
                <oneWay />
                <textMessageEncoding messageVersion="Soap12WSAddressing10" />
                <httpTransport authenticationScheme="Anonymous" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://1.2.3.4/Code/Code.svc"
      binding="customBinding" bindingConfiguration="Code.DualEndPoint"
      contract="CodeProxy.ICode" name="Code.DualEndPoint" />
    </client>
</system.serviceModel>

Everything works great when I run it against http://localhost/Code/Code.svc but, as soon as I put the client somewhere else, it doesn't work. 当我在http://localhost/Code/Code.svc上运行它时,一切工作都很好,但是,一旦将客户端放到其他地方,它就无法工作。 I don't think it's firewall issues because the old version using the wsDualHttpBinding works ok. 我认为这不是防火墙问题,因为使用wsDualHttpBinding的旧版本可以正常工作。 Also because I wiresharked it. 也因为我用电线把它扯了。

Both versions send their CreateSequence request 两个版本都发送其CreateSequence请求

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</a:Action>
        <a:MessageID>urn:uuid:222d5f6a-cca4-4a4b-b8bc-3347b81b425a</a:MessageID>
        <a:ReplyTo>
            <a:Address>http://1.2.3.4:1234/CodeClient/8f191330-523a-4820-a784-46fe364aebcc</a:Address>
        </a:ReplyTo>
        <a:To s:mustUnderstand="1">http://hostname.com/Code/Code.svc</a:To>
    </s:Header>
    <s:Body>
        <CreateSequence xmlns="http://schemas.xmlsoap.org/ws/2005/02/rm">
            <AcksTo>
                <a:Address>http://1.2.3.4:1234/CodeClient/8f191330-523a-4820-a784-46fe364aebcc</a:Address>
            </AcksTo>
            <Offer>
                <Identifier>urn:uuid:f7a18edc-e79f-4d96-a90d-696d1055b592</Identifier>
            </Offer>
        </CreateSequence>
    </s:Body>
</s:Envelope>

and receive an HTTP 202 accepted from the service, but the new client never goes to send the actual function call request. 并从服务接受HTTP 202,但是新客户端永远不会发送实际的函数调用请求。 The old one starts it right away but the new binding hangs until the SendTimeout is met and it throws an exception. 旧的立即启动它,但是新的绑定挂起,直到遇到SendTimeout并引发异常。 What is my new binding waiting for that causes it not to send the function call request and how can I make it stop waiting? 我正在等待的新绑定导致什么导致它不发送函数调用请求?如何使它停止等待? Thanks! 谢谢!

By omitting clientBaseAddress from my <compositeDuplex/> element in my client binding, I guess I was confusing the service about where to direct its response? 通过从客户端绑定中的<compositeDuplex/>元素中省略clientBaseAddress ,我想我在将服务定向到何处混淆了服务? I don't know. 我不知道。 Either way, it is now working with this updated node: 无论哪种方式,它现在都可以与此更新的节点一起使用:

<compositeDuplex clientBaseAddress="http://1.2.3.4:1234/CodeClient"/>

<compositeDuplex/> is still attributeless in my service web.config. <compositeDuplex/>在我的服务web.config中仍然是无属性的。 However, now I'm facing a different problem. 但是,现在我面临另一个问题。 Programmatically updating the clientBaseAddress for a custom binding is proving to be quite difficult. clientBaseAddress证明,以编程方式更新clientBaseAddress以进行自定义绑定非常困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM