views:

73

answers:

1

I am encountering an issue trying to route my WCF client requests through Fiddler. I have searched the web high and low, and found only two references to Fiddler having problems when WCF services are configured to listen on IPv4, but IPv6 is enabled. However, while my issue is similar, it does not seem to be my problem.

I am encountering issues connecting to services hosted on IPv4 ports. The following exception is thrown by my WCF clients when my bindings are configured to use the fiddler proxy. I have disabled IPv6 support in Fiddler's options, and made sure my bindings are properly configured to use the proxy.

Exception report:

System.ServiceModel.EndpointNotFoundException: Could not connect to http://campus.services.ecollege-labs.com/Entity/Foundation/v1.0/EducationalPartnerSvc. TCP error code 10061: No connection could be made because the target machine actively refused it 10.181.3.23:8888. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.181.3.23:8888 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() --- End of inner exception stack trace ---

Server stack trace: at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IMS.EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvc.FindByClientString(String clientString) at IMS.EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvcClient.FindByClientString(String clientString) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Facades.Campus\Service References\EducationalPartner\Reference.cs:line 428 at IMS.EnterpriseServices.Facades.Campus.CampusEntityFacade.GetEPID(String clientString) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Facades.Campus\CampusEntityFacade.cs:line 37 at IMS.EnterpriseServices.Transformation.Domain.TransformationSvc.TransformCreateGroupRequest(createGroupRequestMessage message) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Transformation.Domain\TransformationSvc.cs:line 106 at IMS.EnterpriseServices.Facades.IMSFacade.TransformCreateGroupRequest(createGroupRequestMessage imsMessage) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Facades\IMSFacade.cs:line 113 at IMS.EnterpriseServices.Domain.TransformationAndEnrichmentCoordinator.ProcessCreateGroupRequestMessage(createGroupRequestMessage message) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Domain\TransformationAndEnrichmentCoordinator.cs:line 140 at IMS.EnterpriseServices.Facades.IMSFacade.<>c_DisplayClass1.b_0(Object o) in C:\P4\HEDI\AS2-dev-dotnext-campus-dev\AS\HEI\Src\CAS\IMS.EnterpriseServices.Facades\IMSFacade.cs:line 135

Binding Configuration:

<customBinding>
  <!-- Secured, WS-Security message signing and encryption, custom binding for IMS endpoints -->
  <binding name="customHttpSecuredNoWSA">
    <security
      defaultAlgorithmSuite="Basic128Rsa15"
      authenticationMode="MutualCertificate"
      securityHeaderLayout="Lax"
      includeTimestamp="false"
      keyEntropyMode="CombinedEntropy"
      messageProtectionOrder="SignBeforeEncrypt"
      messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
      requireSignatureConfirmation="false"
      requireSecurityContextCancellation="false"
      allowSerializedSigningTokenOnReply="true">
      <localServiceSettings detectReplays="false" />
    </security>
    <textMessageEncoding
      messageVersion="Soap11"
      writeEncoding="utf-8">
      <readerQuotas
        maxArrayLength="1048576"
        maxStringContentLength="4194304"
        maxBytesPerRead="4194304"
        maxNameTableCharCount="4194304"
      />
    </textMessageEncoding>
    <httpTransport
      maxBufferPoolSize="4194304"
      maxBufferSize="1048576"
      maxReceivedMessageSize="1048576"
      proxyAddress="http://my.host.name:8888"
      useDefaultWebProxy="false"
    />
  </binding>
</customBinding>
+1  A: 

Thanks to comments from Jon Skeet and Paolo, I was able to resolve this issue. It appears that something (possibly a firewall) is interfering with connections to my host name/ip. Using 127.0.0.1 works, however it must be specified as follows in WCF configuration:

proxyAddress="http://127.0.0.1.:8888"

Note the extra period at the end of the 127.0.0.1 loopback address. Without the period, WCF has some kind of hard-coded check to prevent the use of a proxy server at your local loopback. (Why Microsoft would explicitly build in a hard-coded exclusion of the local loopback from proxy server usage is beyond me, but at least this trick works.)

jrista