C# OnExit未通过asp.net项目中的PostSharp进入
我已经安装了PostSharp,它似乎正在工作,但我没有让它进入OnExit(我已经记录了安装程序,以确保它正在工作) 使用asp.net进行配置有点棘手-或者只是我。。。我正在使用1.5新版本 我的web.config中基本上有以下内容,我必须添加SearchPath,否则它找不到我的程序集C# OnExit未通过asp.net项目中的PostSharp进入,c#,asp.net,postsharp,cil,C#,Asp.net,Postsharp,Cil,我已经安装了PostSharp,它似乎正在工作,但我没有让它进入OnExit(我已经记录了安装程序,以确保它正在工作) 使用asp.net进行配置有点棘手-或者只是我。。。我正在使用1.5新版本 我的web.config中基本上有以下内容,我必须添加SearchPath,否则它找不到我的程序集 <postsharp directory="C:\Program Files\PostSharp 1.5" trace="true"> <parameters>
<postsharp directory="C:\Program Files\PostSharp 1.5" trace="true">
<parameters>
<!--<add name="parameter-name" value="parameter-value"/>-->
</parameters>
<searchPath>
<!-- Always add the binary folder to the search path. -->
<add name="bin" value="~\bin"/>
</searchPath>
</postsharp>
我已经设置了跟踪功能,但奇怪的是,它似乎构建到了临时目录,也许这是我的问题,我不确定。。因此我做F5。。。是否可以命名输出目录和输出文件??如您所见,它正在temp dir中编辑一个DLL,因此IIS不再控制它,因此它不会执行它
糊涂了!:-)
C:\Program Files\PostSharp 1.5\PostSharp.exe”/p:Output=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\MyItemVC-1.2\c2087140\8ac2dc93\PostSharp\App_Web\u 04ae3ewy.dll”“/p:IntermediateDirectory=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\MyItemVC-1.2\c2087140\8ac2dc93\PostSharp”/P:CleanIntermediate=False/P:ReferenceDirectory=/P:SignAssembly=False/P:PrivateKeyLocation=/P:ResolvedReferences=“/P:SearchPath=C:\Source Code\Visual Studio 2008\Projects\MyItemVC\MyItemVC\bin,”/V/SkipAutoUpdate“C:\Program Files\PostSharp 1.5\Default.psproj”“C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NET临时文件\myItemVC-1.2\c2087140\8ac2dc93\before postsharp\App\u Web\u 04ae3ewy.dll” PostSharp 1.5[1.5.6.627]-版权所有(c)Gael Fraiteur,2005-2009
信息PS0035:C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe“C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c087140\8ac2dc93\postsharp\App\u Web\u 04ae3ewy.il”/QUIET/DLL/PDB”/RESOURCE=C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NET临时文件\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web\u 04ae3ewy.res”“/OUTPUT=C:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NET临时文件\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web\u 04ae3ewy.dll“/SUBSYSTEM=3/FLAGS=1/BASE=18481152/STACK=1048576/ALIGNMENT=512/MDV=v2.0.50727PostSharp.AspNet实现IAssemblyPostProcessor。路径是通过ASP.NET传递的。PostSharp所做的是,它在ASP.NET传递的目录中创建一个临时子目录,将其输出写入其中,然后将输出复制回输入
没有办法改变这种机制(而且我也看不出任何理由)。ermm ok。。。我没有意识到它被复制回来了。。。。所以不管你知道为什么OnExit、OneException和OneTry没有执行。。。我能给你提供更多的信息吗?不知道。您可以尝试使用aspnet_编译器进行编译,然后使用Reflector.hi查看结果。。我已经和reflector核对过了,我在类中看到了我的Loggable属性。。我看到了定义loggable的实际类。。那么,这证明它有效吗?[Serializable]公共类LoggableAttribute:OnMethodBoundaryAspect{//Methods public LoggableAttribute();公共重写void OnEntry(MethodExecutionEventArgs事件参数);公共重写void OnException(MethodExecutionEventArgs事件参数);公共重写void OnExit(MethodExecutionEventArgs事件参数);