How to configure StructureMap for asp.net MVC 5

前端 未结 4 2202
Happy的楠姐
Happy的楠姐 2021-02-02 14:29

I\'m getting below error. I setup it similar to asp.net mvc 4.

No parameterless constructor defined for this object. Description: An unhandled exception

4条回答
  •  情书的邮戳
    2021-02-02 14:52

    Thank you for all the reply finally found the issue. In my service class I refer a app setting but didn't define it on the web.config file because of that structuremap couldn't inject an instance of my service class.

    private readonly string _path =
                ConfigurationManager.AppSettings["vp"].ToString(CultureInfo.InvariantCulture);
    

提交回复
热议问题