【发布时间】:2018-12-04 23:47:20
【问题描述】:
我在尝试使用 Visual Studio 2015 中名为 MvcIntegrationTestFramework 的项目对我的 ASP.NET MVC 项目运行单元测试时遇到此错误。正如我搜索的大多数解决方案建议切换到使用 IIS Express .但我已经在使用 IIS Express。我也可以设置 IIS,但我不想这样做,因为多个开发人员必须在他们的环境中做同样的事情。
其他人建议直接修改 Response.Headers 集合可能会导致此错误,但我没有看到项目中的任何代码可以这样做。
您还有什么其他我可能忽略的可能导致此错误的地方吗?
这是完整的错误和堆栈跟踪...
[PlatformNotSupportedException:此操作需要集成 IIS 管道模式。] System.Web.HttpResponse.get_Headers() +242
Microsoft.Owin.Host.SystemWeb.OwinCallContext.CreateEnvironment() +532 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.GetInitialEnvironment(HttpApplication 申请)+372
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.PrepareInitialContext(HttpApplication 申请)+19
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(对象 发件人,EventArgs e,AsyncCallback cb,对象额外数据)+354
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +673 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146
【问题讨论】:
-
您可以使用 Jexus Manager 查看应用程序池设置,jexusmanager.com
-
似乎这与版本控制和 IIS 应用程序池设置更相关:weblogs.asp.net/scottgu/introducing-iis-express。确保运行的 IIS 版本至少使用与项目要求相同或更高的版本。
标签: asp.net-mvc visual-studio-2015 owin iis-express