2015-07-13 55 views
0

在AfterReceiveRequest方法中,我找到了請求類型(httprequest或Soap reqest)嗎?WCF AfterReceiveRequest(IDispatchMessageInspector的成員)找出請求類型?

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

你是指http還是net.tcp? SOAP可以是http請求的主體,因此它們不是相互排斥的。 – Crowcoder

+0

@Crowcoder Yess –

回答

0

我沒有這個做自己,但因爲沒有人給了一個答案,我會建議嘗試這樣的: 代替(或補充)實施IDispatchMessageInspector,實現IServiceBehavior並在Validate方法檢查URI方案:

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