【发布时间】:2016-10-20 16:40:17
【问题描述】:
我有一个 BizTalk 2013r2 应用程序,它有一个使用 WCF-WebHttp 适配器的请求响应发送端口。发送端口使用我开发的自定义 WCF 行为来附加 OAuth 授权标头,可以查看here 的详细信息。从我的 Azure 开发虚拟机运行时一切正常,但我刚刚在本地 BizTalk 服务器上运行了第一次,这是它在运行时需要运行的地方,我遇到了问题!
通过调整发送端口适配器配置页面的“代理”选项卡中的设置,我尝试了以下场景:
- 通过公司代理 - 失败
- 直接到目标 Web 服务,没有代理 - 失败
- 通过提琴手 - 作品
- 本地模拟服务(由 SoapUi 托管)- 工作
如果请求是通过公司代理或直接发出的(已创建网络规则以允许这样做),那么我会收到 EndpointNotFound 异常
针对失败的请求运行 WCF 跟踪时,我得到以下“消息日志跟踪”:
紧随其后的是:
第二个请求似乎与第一个相同,只是添加了一个 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 在实时服务器上运行并不是一个真正的选择!
【问题讨论】:
-
通过 Fiddler 的请求是否有 To Addressing?
-
抱歉科林,我的帖子不太好 - 希望我的编辑得到澄清?
-
如果您尝试访问本地端点,它是否有效?像内部一样,根本没有代理?
-
嗨@Johns-305,我使用 SoapUI 创建了目标 Web 服务的模拟。然后我将发送端口的地址更改为指向本地模拟(使用 http 而不是 https)。该请求运行良好,返回了模拟的响应。我仍然感到困惑,但认为问题可能与api-sandbox.tradeshift.com 发出的证书有某种关系——尽管这似乎是有效的
标签: wcf oauth http-headers biztalk fiddler