0
我有一個SoapExtension
其中,現在,只寫日誌:的SoapExtension不會執行
public class CatchInputParametersExtension : SoapExtension
{
public override object GetInitializer(Type serviceType)
{
return null;
}
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
{
return null;
}
public override void Initialize(object initializer)
{
//nothing to do
}
public override void ProcessMessage(SoapMessage message)
{
Logger.Log("++++++++ Before Everything +++++++ " + message.ToString(), LogLevel.Info);
switch (message.Stage)
{
case SoapMessageStage.BeforeSerialize:
Logger.Log("++++++++ Before Serialize +++++++ " + message.ToString(), LogLevel.Info);
break;
case SoapMessageStage.AfterSerialize:
Logger.Log("++++++++ After Serialize +++++++ " + message.ToString(), LogLevel.Info);
break;
case SoapMessageStage.BeforeDeserialize:
Logger.Log("++++++++ Before Deserialize +++++++ " + message.ToString(), LogLevel.Info);
break;
case SoapMessageStage.AfterDeserialize:
Logger.Log("++++++++ After Deserialize +++++++ " + message.ToString(), LogLevel.Info);
break;
default:
throw new Exception("invalid stage");
}
}
}
我試圖與這兩個web.config
文件中註冊它
<webServices>
<soapExtensionTypes>
<add type="WebAdminServices.SoapExtensions.CatchInputParametersExtension,WebAdminServices" priority="1" group="Low"/>
</soapExtensionTypes>
</webServices>
和SoapExtensionAttribute
[AttributeUsage(AttributeTargets.Method)]
public class CatchInputParametersAttribute : SoapExtensionAttribute
{
private int priority;
public override Type ExtensionType
{
get { return typeof(CatchInputParametersExtension); }
}
public override int Priority
{
get { return priority; }
set { priority = value; }
}
}
這是註冊
[WebMethod(Description = "Test1")]
[CatchInputParametersAttribute(Priority=1)]
public string Test1(int a, int b, int c)
{
// do stuff
return stuff;
}
但它們都不起作用,日誌文件從不顯示那些++++++
行。請提供任何提示?