' System.InvalidProgramException'在System.Net.Http.dll c#

时间:2017-10-24 04:02:50

标签: c# .net unit-testing asp.net-web-api system.net

我的单元测试项目中为WebApi编写的测试失败。

抛出的异常是' System.InvalidProgramException'在System.Net.Http.dll中 附加信息:公共语言运行时检测到无效程序。

在初始化控制器的请求对象以在测试中使用时抛出:

        this.samplecontroller.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } };

我正在努力解决这个问题,我们将非常感谢任何帮助。

我使用的.Net Framework是4.6.1

0 个答案:

没有答案
相关问题