BizTalk REST 调用仅在 Fiddler 运行 时有效

BizTalk REST call works only when Fiddler running

我有一个 BizTalk 2013r2 应用程序,它有一个使用 WCF-WebHttp 适配器的请求响应发送端口。发送端口使用我开发的自定义 WCF 行为来附加 OAuth 授权 header,可以查看详细信息 here。当从我的 Azure 开发虚拟机 运行ning 时,一切都很好,但我只是第一次 运行 在 on-prem BizTalk 服务器上,这是它需要 运行 从直播开始,我就遇到了问题!

通过调整发送端口适配器配置页面的 "Proxy" 选项卡中的设置,我尝试了以下方案:

如果请求是通过公司代理或直接发出的(已创建网络规则以允许这样做),那么我会收到 EndpointNotFound 异常

当 运行ning WCF trace against a failed request 时,我得到以下 "Message Log Trace":

紧随其后的是:

第二个请求似乎与第一个请求相同,只是添加了一个 Addressing 元素,并使用一个空的 Action 元素完成。我可以看到第二个是带有 source=TransportSend 的日志,而第一个有 source=ServiceLevelSendRequest。在第二个日志之后,我立即看到异常:

<ExceptionType>System.ServiceModel.EndpointNotFoundException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There was no endpoint listening at https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents/dispatcher/?documentId=66553703-4f22-4294-9a28-1f3ecb22fcf2&documentProfileId=tradeshift.order.1.0 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.</Message>
<StackTrace>
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStreamAsyncResult.CompleteGetRequestStream(IAsyncResult result)
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStreamAsyncResult.OnGetRequestStream(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.HttpWebRequest.SetResponse(Exception E)
at System.Net.ConnectionReturnResult.SetResponses(ConnectionReturnResult returnResult)
at System.Net.Connection.CompleteConnectionWrapper(Object request, Object state)
at System.Net.PooledStream.ConnectionCallback(Object owningObject, Exception e, Socket socket, IPAddress address)
at System.Net.ServicePoint.ConnectSocketCallback(IAsyncResult asyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>

在我通过 Fiddler 发出请求的地方,我看到了相同的两个出站日志,一个用于 ServiceLevelSendRequest,一个用于 TransportSend。然后我看到 TransportReceive 后跟 ServiceLevelReceiveReply,两者都包含一个 HttpResponse 元素

对于如何解决此问题的任何建议,我将不胜感激,以便可以通过公司代理或直接发出请求 - 坚持在实时服务器上使用 Fiddler 运行s 并不是一个真正的选择!

今天早上 session 与 LAN 工程师相处得很好,他能够 运行 在公司代理上进行跟踪。我们 运行 这些测试:

  1. 发送彻底的 fiddler - 它有效,可以看到 fiddler 正在通过公司代理进行路由
  2. 关闭 fiddler,重试测试 - 它失败了,但工程师看不到任何痕迹
  3. 打脸!我意识到我仍然将 fiddler
  4. 的发送端口代理设置为 127.0.0.1:8888
  5. 更改了发送端口以使用公司代理 - 成功了!

工程师确实注意到从 api-sandbox.tradeshift.com 返回的目标 IP 地址确实有所不同。所以看起来它在他们这边是负载平衡的。我们的公司防火墙没有他们每个服务器的地址,所以也许这可以解释为什么上周我无法让 BizTalk 通过我们的公司代理工作。