As, I am working on web api project and trying to implement the PostSharp Aspect class to loggin the request and other staff. OnEntry method OnSucess method is not getting called when api method is calling. If I use same Aspect class in other MVC project which already in same solution then that works. Only Aspect class not executing in web api project.
I have already added the Postsharp DLL in web api project.
Aspect class
Web api controller



PostSharp is a post-compiler and it needs to integrate with the build process. This is done through the MSBuild target file
PostSharp.targetsand just having the assembly reference is not enough.Most likely your project does not import this target file.
It is included in
PostSharpNuGet package and should be automatically imported if your project usesPackageReferencestyle of NuGet package references. If you are usingpackages.config, you need to make sure that your project file includes<Import Project="<path_to_package>\PostSharp.targets" />. This may be sometimes missing after upgrading the package or if you have manually added the reference.Similarly, if you are using Zip distro, this import needs to be present in your project file and pointing to the directory where PostSharp is unzipped.