EndpointNotFoundException'无法连接',因为'目标计算机主动拒绝它'通过Fiddler连接

时间:2010-06-28 18:21:45

标签: .net wcf proxy fiddler

我在尝试通过Fiddler路由我的WCF客户端请求时遇到问题。我已经搜索了网络的高低,发现当WCF服务配置为侦听IPv4时,只有两个对Fiddler的引用有问题,但启用了IPv6。然而,虽然我的问题很相似,但似乎不是我的问题。

我遇到连接到IPv4端口上托管的服务的问题。当我的绑定配置为使用fiddler代理时,我的WCF客户端抛出以下异常。我已经在Fiddler的选项中禁用了IPv6支持,并确保我的绑定已正确配置为使用代理。

异常报告:

  

System.ServiceModel.EndpointNotFoundException:   无法连接到   http://campus.services.ecollege-labs.com/Entity/Foundation/v1.0/EducationalPartnerSvc。   TCP错误代码10061:无连接   可以因为目标而成   机器主动拒绝了   10.181.3.23:8888。 ---> System.Net.WebException:无法执行   连接到远程服务器--->   System.Net.Sockets.SocketException:没有   可以联系,因为   目标机器积极拒绝它   10.181.3.23:8888在System.Net.Sockets.Socket.DoConnect(EndPoint   endPointSnapshot,SocketAddress   socketAddress)at   System.Net.ServicePoint.ConnectSocketInternal(布尔   connectFailure,Socket s4,Socket s6,   插座及放大器; socket,IPAddress&地址,   ConnectSocketState状态,IAsyncResult   asyncResult,Int32超时,异常&   例外)---内心的结束   异常堆栈跟踪--- at   System.Net.HttpWebRequest.GetRequestStream(TransportContext&安培;   上下文)   System.Net.HttpWebRequest.GetRequestStream()   在   System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()   ---内部异常堆栈跟踪结束---

     

服务器堆栈跟踪:at   System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()   在   System.ServiceModel.Channels.HttpOutput.Send(时间跨度   超时)at   System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(消息   消息,TimeSpan超时)at   System.ServiceModel.Channels.RequestChannel.Request(消息   消息,TimeSpan超时)at   System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息   消息,TimeSpan超时)at   System.ServiceModel.Channels.ServiceChannel.Call(字符串   动作,布尔单向,   ProxyOperationRuntime操作,   Object [] ins,Object [] outs,TimeSpan   超时)at   System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage   methodCall,ProxyOperationRuntime   操作)   System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天   消息)

     

在[0]处重新抛出异常:at   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天   reqMsg,IMessage retMsg)at   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培;   msgData,Int32类型)at   IMS.EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvc.FindByClientString(字符串   clientString)at   IMS.EnterpriseServices.Facades.Campus.EducationalPartner.EducationalPartnerSvcClient.FindByClientString(字符串   clientString)in   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Facades.Campus \服务   参考\ EducationalPartner \ Reference.cs:行   428在   IMS.EnterpriseServices.Facades.Campus.CampusEntityFacade.GetEPID(字符串   clientString)in   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Facades.Campus \ CampusEntityFacade.cs:行   37点   IMS.EnterpriseServices.Transformation.Domain.TransformationSvc.TransformCreateGroupRequest(createGroupRequestMessage   消息)   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Transformation.Domain \ TransformationSvc.cs:行   106点   IMS.EnterpriseServices.Facades.IMSFacade.TransformCreateGroupRequest(createGroupRequestMessage   imsMessage)in   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Facades \ IMSFacade.cs:行   113点   IMS.EnterpriseServices.Domain.TransformationAndEnrichmentCoordinator.ProcessCreateGroupRequestMessage(createGroupRequestMessage   消息)   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Domain \ TransformationAndEnrichmentCoordinator.cs:行   140点   IMS.EnterpriseServices.Facades.IMSFacade<> c__DisplayClass1.b__0(对象   o)in   C:\ P4 \ HEDI \ AS2-DEV-dotnext校园-dev的\ AS \ HEI的\ src \ CAS \ IMS.EnterpriseServices.Facades \ IMSFacade.cs:行   135

绑定配置:

<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 个答案:

答案 0 :(得分:3)

感谢Jon Skeet和Paolo的评论,我能够解决这个问题。似乎某些东西(可能是防火墙)干扰了与我的主机名/ ip的连接。使用127.0.0.1有效,但必须在WCF配置中指定如下:

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

请注意127.0.0.1环回地址末尾的额外时间段。如果没有这段时间,WCF会进行某种硬编码检查,以防止在本地环回中使用代理服务器。 (为什么微软明确地将代码服务器使用的本地环回的硬编码排除在我之外,但至少这个技巧有效。)