EndpointNotFoundException "Failed to connect" because "the target machine has actively refused this." Connect via Fiddler

I ran into a problem trying to redirect my WCF client requests through Fiddler. I searched the website high and low, and found only two links to Fiddler, which have problems when WCF services are configured to listen on IPv4, but IPv6 is turned on. However, although my problem is similar, it does not seem to be my problem.

I'm having trouble 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 turned off IPv6 support in the Fiddler settings and made sure my bindings were configured correctly to use proxies.

Exclusion Report:

System.ServiceModel.EndpointNotFoundException: Failed to connect to http://campus.services.ecollege-labs.com/Entity/Foundation/v1.0/EducationalPartnerSvc . TCP error code 10061: No connection can be made because the target machine actively refused 10.181.3.23:8888. ---> System.Net.WebException: cannot connect to the remote server ---> System.Net.Sockets.SocketException: No connection can be made because the target machine actively refused it 10.181.3.23:8888 in System.Net .Sockets.Socket.DoConnect (EndPoint endPointSnapshot, SocketAddress socketAddress) in System.Net.ServicePoint.ConnectSocketInternal (Boolean connectFailure, Socket s4, Socket s6, Connector & amp; socket, IPAddress & address, ConnectSocketState state, IAsyncResult async Int32, exception and amp; exception) --- End of the internal trace of the exception stack - when System.Net.HttpWebRequest.GetRequestStream (TransportContext & context) in System.Net.HttpWebRequest.GetRequestStream () in System.S erviceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream () --- End of internal trace of exception stack ---

Server Stack Trace: at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream () in System.ServiceModel.Channels.HttpOutput.Send (TimeSpan Timeout), in System.ServiceModel.Channels.HttpChannelReventChannelReventChannFelnestHannelReventChannFellfelnest TimeSpan timeout) on System.ServiceModel.Channels.RequestChannel.Request (Message message, TimeSpan timeout) on System.ServiceModel.Dispatcher.RequestChannelBinder.Request (Message message, TimeSpan timeout) on System.ServiceModel.Channels. ServiceChannel.Call (String action, Boolean oneway, Operation ProxyOperationRuntime, Object [] ins, Object [] of outs, TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage method Call, ProxyOperationRunter.opement. Operation). ServiceChannelProxy.Invoke (ches Hell Post)

Exception thrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (iMessage reqMsg, IMessage retMsg) in System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & Intent32) for type. EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvc.FindByClientString (String clientString) in IMS.EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvcClient.FindByClientString (String clientI-Pp-Dntp-2) \ AS \ KHEY \ Src \ CAS \ IMS.EnterpriseServices.Facades.Campus \ Service References \ EducationalPartner \ Reference.cs: line 428 in IMS.EnterpriseServices.Facades.Campus.CampusEntityFacade.GetEPID (String clientString) in C: \ P4 \ HEDI \ AS2-DEV-dotnext-Campus-DEV \ AS \\ Src HEI \ CAS \ IMS.EnterpriseServices.Facades.Campus \ CampusEntityFacade.cs: line 37 on IMS.EnterpriseServices.Transformation.Domain.TransformationSvc.TransformCre equest (createGroupRequestMessage message) to C: \ P4 \ HEDI \ AS2-DEV-dotnext-Campus-DEV \ AS \\ Src HEI \ CAS \ IMS.EnterpriseServices.Transformation.Domain \ TransformationSvc.cs: line 106 in IMS.EnterpriseServices. Facades.IMSFacade.TransformCreateGroupRequest (createGroupRequestMessage imsMessage) in C: \ P4 \ HEDI \ AS2-DEV-dotnext-Campus-DEV \ AS \\ Src HEI \ CAS \ IMS.EnterpriseServices.Facades \ IMSFacade.IMSFacade.IMSFac.IMS. EnterpriseServices.Domain.TransformationAndEnrichmentCoordinator.ProcessCreateGroupRequestMessage (createGroupRequestMessage message) in C: \ P4 \ HEDI \ AS2-DEV-dotnext-Campus-DEV \ AS \\ Src HEI \ CAS \ IMS.EnterpriseermendSermservice IMS.EnterpriseServices.Facades.IMSFacade <. > C__DisplayClass1.b__0 (Object o) in C: \ P4 \ HEDI \ AS2-DEV-dotnext-Campus-DEV \ AS \\ Src HEI \ 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> 
+4
source share
1 answer

Thanks to the comments of John Skeet and Paolo, I was able to solve this problem. It looks like something (possibly a firewall) is interfering with connecting to my hostname / ip. Using 127.0.0.1 works, however, in the WCF configuration, it should be specified as follows:

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

Note the extra period at the end of the return address 127.0.0.1. Without a period, WCF has some kind of hard-coded check to prevent the use of a proxy server in your local loop. (Why is Microsoft explicitly building a hard-coded local loopback exception from using a proxy server outside of me, but at least this trick works.)

+3
source

Source: https://habr.com/ru/post/1314111/