【发布时间】:2018-06-30 00:41:15
【问题描述】:
我们正在运行更新的 2008 服务器,在开发机器上运行 TFS 2012 和 VS 2012。该解决方案使用 MSBuild 在服务器上部署和运行测试。所有测试都通过了开发箱,但只有不调用本地部署的 WCF 服务器(托管在 IIS 中)的测试失败。所有服务调用的例外情况如下:
> Test method TestProject.TestClass.TestMethod threw exception:
> System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel,
> cannot be used for communication because it is in the Faulted state.
>
> Server stack trace:
> at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan
> timeout)
> at System.ServiceModel.Channels.ServiceChannel.System.IDisposable.Dispose()
> Exception rethrown at [0
enter code here
NETWORK SERVICE 具有相应的权限。电源已打开。有什么想法吗?
【问题讨论】:
-
从技术上讲,如果您正在调用 Web 服务,我认为这些不是单元测试,但这无关紧要。您是否研究过 WCF 跟踪?打开配置文件中的 WCF 跟踪功能,看看是否有任何东西。另外,您使用什么 URL 来访问 WCF?本地主机?也许是环回或 DNS 解析等。
-
同意,这些并不是真正的单元测试。所以我取得了更多进展:这似乎是一个权限问题,因为 MSTest 在我的帐户下本地运行,但在构建服务器上它作为 NETWORK SERVICE 运行。 WCF 跟踪显示 SecurityNegotiationException。我想我现在的问题是......我缺少什么权限?
标签: unit-testing msbuild