2012-06-05 38 views
0

我有一個Restful服務,它在傳遞產品代碼時返回產品信息。 界面會看起來像如何在ASP.Net中使用Spring AOP登錄RESTful服務

[OperationContract] 
    [WebInvoke(UriTemplate = "Product/{ProductCode}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] 
    Product GetProductInformation(String ProductCode); 

我通過輸入URI訪問來自瀏覽器的服務。

我實現通過Spring AOP的日誌。如何使用Spring AOP截取方法。我嘗試過使用NameMatchMethodPointcutAdvisor,但我沒有在訪問服務之前使用spring創建服務對象,它無法攔截。有沒有任何可能的方式來實現這個日誌記錄?

回答

0

最後我找到了答案..

有用的人..

攔截可能通過允許彈簧廠創建服務對象。爲此在服務主機svc文件中添加這樣的Factory屬性。

<%@ ServiceHost Language="C#" Debug="true" Service="Servicename" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %> 

爲了防止.NET創建在handlers部分下web.config文件服務對象中<system.webServer>刪除以下

<modules runAllManagedModulesForAllRequests="true"/> 

和添加

<remove name="WebServiceHandlerFactory-Integrated"/>