Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ';系统无效程序异常';在System.Net.Http.dll c中#_C#_.net_Unit Testing_Asp.net Web Api_System.net - Fatal编程技术网

C# ';系统无效程序异常';在System.Net.Http.dll c中#

C# ';系统无效程序异常';在System.Net.Http.dll c中#,c#,.net,unit-testing,asp.net-web-api,system.net,C#,.net,Unit Testing,Asp.net Web Api,System.net,我的单元测试项目中为WebApi编写的测试失败了 引发的异常是System.Net.Http.dll中的“System.InvalidProgrameException” 其他信息:公共语言运行库检测到无效程序 初始化要在测试中使用的控制器的请求对象时引发: this.samplecontroller.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKe

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

引发的异常是System.Net.Http.dll中的“System.InvalidProgrameException” 其他信息:公共语言运行库检测到无效程序

初始化要在测试中使用的控制器的请求对象时引发:

        this.samplecontroller.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } };
我正在努力解决这个问题,任何帮助都将不胜感激


我使用的.Net Framework是4.6.1

您可以将您尝试进行单元测试的代码与完整的单元测试代码一起共享吗?您可以将您尝试进行单元测试的代码与完整的单元测试代码一起共享吗?