简体   繁体   English

WCF AfterReceiveRequest(IDispatchMessageInspector的成员)找出请求类型吗?

[英]WCF AfterReceiveRequest (member of IDispatchMessageInspector) find out request type?

Is there any way in AfterReceiveRequest method that I find out requst type(httprequest Or Soap reqest)? AfterReceiveRequest方法中有什么方法可以找出请求类型(httprequest或Soap reqest)?

public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
{
    //get request type
}

I haven't done this myself but since nobody has given an answer I would suggest trying this: Instead of (or in addition to) implementing IDispatchMessageInspector , implement IServiceBehavior and inspect the URI Scheme in the Validate method: 我自己尚未完成此操作,但由于没有人给出答案,因此建议您尝试以下操作:代替(或除了实现IDispatchMessageInspector之外),实现IServiceBehavior并在Validate方法中检查URI方案:

public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
    foreach (ServiceEndpoint item in serviceDescription.Endpoints)
    {
        string theScheme = item.Binding.Scheme;
    }
}

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

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