12

我想在不安装VS2012的情况下在另一台机器上运行WcfTestClient(包含在VS2012中的WcfTestClient)。这可能吗?在我的机器已经安装了.NET 4.5,但是当我尝试添加Web服务它给了我下面的堆栈跟踪:无法在复制到另一台机器时在WcfTestClient中添加服务

************** Exception Text ************** 
System.NullReferenceException: Object reference not set to an instance of an object. 
    at Microsoft.Tools.Common.SdkPathUtility.GetRegistryValue(String registryPath, String registryValueName) 
    at Microsoft.Tools.Common.SdkPathUtility.GetSdkPath(Version targetFrameworkVersion) 
    at Microsoft.Tools.TestClient.ToolingEnvironment.get_MetadataTool() 
    at Microsoft.Tools.TestClient.ServiceAnalyzer.GenerateProxyAndConfig(String projectPath, String address, String configPath, String proxyPath, Int32 startProgressPosition, Int32 endProgressPostition, BackgroundWorker addServiceWorker, String& errorMessage) 
    at Microsoft.Tools.TestClient.ServiceAnalyzer.AnalyzeService(String address, BackgroundWorker addServiceWorker, Single startProgress, Single progressRange, String& errorMessage) 
    at Microsoft.Tools.TestClient.Workspace.AddServiceProject(String endpoint, BackgroundWorker addServiceWorker, Single startProgress, Single progressRange, String& error) 
    at Microsoft.Tools.TestClient.AddServiceExecutor.Execute(AddServiceInputs inputs, Workspace workspace, BackgroundWorker addServiceWorker) 
    at Microsoft.Tools.TestClient.UI.MainForm.addServiceWorker_DoWork(Object sender, DoWorkEventArgs e) 
    at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) 
    at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) 

在WcfTestClient文件夹中我只有2个文件,有我需要的任何其他文件包括? WcfTestClient.exe WcfTestClient.exe.config

两者都直接从VS2012 IDE文件夹中复制。

+1

我也一样,没有线索。 – abatishchev 2013-05-17 20:24:46

+0

您是否尝试过使用[Process Explorer](http://technet.microsoft.com/zh-cn/sysinternals/bb896653.aspx)查看测试客户端正在加载哪些dll?这可能会给你一个线索,你可能会错过什么。 – Tombala 2013-05-17 20:30:41

+0

呵呵,实际上看着堆栈跟踪,它试图读取SDK特定的注册表项。没有我认为的WCF SDK,它带有VS,所以你可能会失败。 – Tombala 2013-05-17 20:32:38

回答

4

WCFTestClient必须在安装了SDK的计算机上运行。它不仅在注册表中查找SDK的位置,而且还运行SDK中的svcutil以生成在运行时连接的代理类。

+3

在使用VS2012 Pro(Update 4)在Windows 7上开发.Net 4.0 WCF服务时,我发现我需要安装[Windows 8.0 SDK](http://msdn.microsoft.com/zh-cn/windows/desktop/ hh852363.aspx),而不是[Windows 7 SDK](http://www.microsoft.com/en-ca/download/details.aspx?id=8279)。 – 2014-02-28 20:00:42

+0

@MattDonald你必须把它分开的答案,所以我可以投票。 – Avram 2015-09-05 14:47:50

+1

@Avram创建了单独的答案! – 2015-09-08 16:37:55

2

在使用VS2012 Pro(Update 4)在Windows 7上开发.Net 4.0 WCF服务时,我发现我需要安装Windows 8.0 SDK,而不是Windows 7 SDK。 (添加了这个答案来替换我以前的评论)。

相关问题