简体   繁体   English

Azure服务总线中继-监视请求流量

[英]Azure Service Bus Relay - Monitoring Request Traffic

We use the Azure Service Bus Relay to expose internal WCF services externally, but when trying to correspond our external service usage with IIS logs - we come up short since there are no entries for Service Bus relay requests in the web server log. 我们使用Azure Service Bus Relay在外部公开内部WCF服务,但是当尝试将我们的外部服务使用与IIS日志相对应时,由于Web服务器日志中没有Service Bus Relay请求条目,因此出现了简短的情况。 This makes sense since we establish an outbound HTTP request to the cloud relay and all requests are serviced via this host connection ( we are using HttpRelayBinding ). 这很有意义,因为我们建立了到云中继的出站HTTP请求,并且所有请求都通过该主机连接进行服务( 我们使用HttpRelayBinding )。

Is there any way to create IIS log entries when servicing relay requests, or must we resort to WCF diagnostic logging to track our relay usage? 在为中继请求提供服务时,有什么方法可以创建IIS日志条目,还是必须使用WCF诊断日志记录来跟踪中继的使用情况? Our goal is to reconcile our Azure billing ( transactions/month ) to our actual relay usage. 我们的目标是使我们的Azure帐单( 交易/月 )与实际中继使用保持一致。 Has anyone else tried this or found a simple solution for tracking or monitoring service bus relay traffic ? 是否有其他人尝试过此方法或找到了用于跟踪或监视服务总线中继流量的简单解决方案?

I am not aware of a mechanism for writing to IIS log directly. 我不知道直接写入IIS日志的机制。

If you need to log the number of requests/responses with status code, you can add a custom IMessageInspector to your service (it can be added via a custom WCF Service behavior). 如果需要使用状态代码记录请求/响应的数量,则可以将自定义IMessageInspector添加到服务中(可以通过自定义WCF服务行为来添加)。 The response message will have HttpResponseMessageProperty which will include the HTTP status code. 响应消息将具有HttpResponseMessageProperty,其中将包含HTTP状态代码。 With this approach, you can log the data in the similar format as the one created by IIS. 使用这种方法,您可以采用与IIS创建的格式相似的格式记录数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM