Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to add service in WcfTestClient when copy to a different machine

I'd like to run WcfTestClient (one that's included with VS2012) on a different machine without installing VS2012. Is this possible? On the machine I've installed .NET 4.5 but when I try to add web services it gives me the following stack trace:

************** 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)

In the WcfTestClient folder I only have 2 files, is there any other files I need to include? WcfTestClient.exe WcfTestClient.exe.config

Both are copied directly from the VS2012 IDE folder.

like image 396
BlueFox Avatar asked Mar 10 '13 18:03

BlueFox


People also ask

How do you test SVC?

Visual Studio provides you a test client to run and debug the service. To use this test client, select your service in Solution Explorer ( CustomerProfile. svc ) and, from the Debug menu, select Start Debugging (or just press F5). Visual Studio will run the code in debug mode using the WCF Test Client, as shown in ...

Where is WcfTestClient exe located?

You can typically find the WCF Test Client (WcfTestClient.exe) in the following location: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE - Community may be one of "Enterprise", "Professional" or "Community" depending on which level of Visual Studio is installed.


3 Answers

The WCFTestClient must be run on a computer with the SDK installed. Not only does it look in the registry to find the location of the SDK, but it also runs the svcutil from the SDK to generate the proxy classes to connect at runtime.

like image 200
GrokSrc Avatar answered Sep 17 '22 19:09

GrokSrc


While developing a .Net 4.0 WCF Service on Windows 7 using VS2012 Pro (Update 4) I found I needed to install the Windows 8.0 SDK, not the Windows 7 SDK as one might otherwise assume. (Added this answer to replace my previous comment).

like image 25
Matt Donald Avatar answered Sep 19 '22 19:09

Matt Donald


A bit late response, but installing the SDK on the target computer is not needed.

You just need to copy some files and ensure the existence of one registry key.

From local installed VS 2015 (v14.0):

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\WcfTestClient.exe
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll

From local installed Windows SDK (v10):

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*

Registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x86  (just ensure all keys exists, no content needed)

Full explanation here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/c3c7221c-c06f-4364-887a-fb20f22877be/wcf-test-client-problem?prof=required (the last response, author: Jakub Bereżański)

like image 32
johey Avatar answered Sep 17 '22 19:09

johey