在Core Web API应用程序中部署后更改了汇编名称
我正在使用VS 2019来开发Core.NET Web API。我正在尝试阅读控制器内部的所有方法和参数。我正在使用存储库模式来开发API。
以下是我的存储库中的代码。
var method = methodbase.getCurrentMethod();
_log4net.info(“汇编名称:” + assembly.getCallingAssembly()。fullName); _log4net.info(“方法名称:” + method.name); _log4nnet.info(“存储库名称:” + method.reflectedType.fullname);var结果= ((System.Reflection.Typeinfo)组件.getCallingAssembly().getTypes() => type.fullname.contains(“ asmecontroller”))。firstordEfault())。dectectMethods; _log4net.info(结果);
日志:
中部署后
在IIS
。
正如我使用日志观察到的那样,汇编名称正在将Demo.dll更改为“汇编名称:匿名托管DynamicMethods Assembly”。
请给我建议解决这个问题。
I am using VS 2019 to develop core.net web Api. I am trying to read the all methods and Parameters inside my controller. I am using Repository pattern to develop API.
Below is the code from my repository.
var method = MethodBase.GetCurrentMethod();
_log4net.Info("Assembly Name : " + Assembly.GetCallingAssembly().FullName);
_log4net.Info("Method Name : " + method.Name);
_log4net.Info("Repository Name :" + method.ReflectedType.FullName);var result =
((System.Reflection.TypeInfo)Assembly.GetCallingAssembly().GetTypes().Where(type
=> type.FullName.Contains("AsmeController")).FirstOrDefault()).DeclaredMethods;
_log4net.Info(result);
Log's:
After deployment in IIS
This code is working as expected and returns the list of Method Info in Debug mode and not working and return Null in Release mode even after deployed in IIS.
As i observed using logs, Assembly name was changing Demo.dll to “ Assembly Name : Anonymously Hosted DynamicMethods Assembly “ after deployment.
Please give me suggestions to solve this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于周围的工作,我直接读取应用程序DLL,而不是读取当前组件。这样我就能从那里访问所有信息。
For the work around i am directly reading the application dll, Instead of reading current assembly. So that i can able to access the all info from there.