Autofac - Make sure that the controller has a parameterless public constructor

后端 未结 6 1221
情歌与酒
情歌与酒 2021-02-07 04:28

I know it\'s been asked and answered before - the reason I\'m asking is because (I think) I tried all suggested solutions to this problem but still can\'t resolve it.

I

6条回答
  •  悲哀的现实
    2021-02-07 05:20

    Assembly.GetCallingAssembly() will return the calling assembly, not the assembly where your types is defined.

    Assembly.GetCallingAssembly Method
    Returns the Assembly of the method that invoked the currently executing method.

    In order to make it works, you should use typeof(IocConfig).Assembly or Assembly.GetExecutingAssembly

提交回复
热议问题