如何找到在授權管理器中爲我的WCF服務調用的端點?C#WCF - 查找調用的端點名稱
目前代碼:
public class AuthorizationManager : ServiceAuthorizationManager
{
protected override bool CheckAccessCore(OperationContext operationContext)
{
Log(operationContext.EndpointDispatcher.ContractName);
Log(operationContext.EndpointDispatcher.EndpointAddress);
Log(operationContext.EndpointDispatcher.AddressFilter);
//return true if the endpoint = "getDate";
}
}
我想這是所謂的終點,但結果目前:
MYWCFSERVICE
https://myurl.co.uk/mywcfservice.svc System.ServiceModel.Dispatcher.PrefixEndpointAddressMessageFilter
我需要的是.svc後的部分eg/ https://myurl.co.uk/mywcfservice.svc/testConnection?param1=1
在這種情況下,我想要返回「testConnection」。
謝謝哥們,得到通過的OperationContext動作: operationContext.RequestContext.RequestMessage.Headers.To.ToString() – markthewizard1234
酷。那麼你應該發佈你自己的答案來啓發未來的讀者。 :) – smoksnes
我已經添加它作爲一個單獨的功能作爲答案 – markthewizard1234