Dot-Net
複製到另一台機器時無法在 WcfTestClient 中添加服務
我想在另一台機器上執行 WcfTestClient(包含在 VS2012 中)而不安裝 VS2012。這可能嗎?在我安裝了 .NET 4.5 的機器上,但是當我嘗試添加 Web 服務時,它給了我以下堆棧跟踪:
************** 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 文件夾中複製的。
WCFTestClient 必須在安裝了 SDK 的電腦上執行。它不僅在系統資料庫中查找 SDK 的位置,而且還從 SDK 執行 svcutil 以生成代理類以在執行時連接。
在使用 VS2012 Pro(更新 4)在 Windows 7 上開發 .Net 4.0 WCF 服務時,我發現我需要安裝 Windows 8.0 SDK,而不是人們可能假設的 Windows 7 SDK。(添加此答案以替換我之前的評論)。