0
這裏是我的WCF服務的方法:如何限制WCF服務方法爲特定的IP
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/CheckID/{id}")]
public string CheckID(string id)
{
/*Check reuqest where it comes from */
}
我希望我的方法來發送響應OK如果它是從http://particularIP.com調用,除非響應錯誤請求/。
我該怎麼做?
我不知道如何使用CheckAccessCore方法,似乎應該overrided但doesnt't出現在我的項目。 – ibubi
您需要在應用程序中包含「System.ServiceModel」dll。 –
謝謝Anand,我可以在不執行CheckAccessCore方法的情況下獲得OperationContext。但是,這是一個非常複雜的對象,clint ip數據被保存在哪裏? – ibubi