Troubleshooting the Getting Started Tutorial

This topic lists the most common problems encountered when working through the Getting Started Tutorial and how to resolve them.

  1. I am unable to find the project files on my hard drive.

  2. Attempting to run the service application: HTTP could not register URL http://+:8000/ServiceModelSamples/Service/. Your process does not have access rights to this namespace.

  3. Attempting to use the Svcutil.exe tool: 'svcutil' is not recognized as an internal or external command, operable program or batch file.

  4. Unable to find the App.config file generated by Svcutil.exe.

  5. Compiling the client application: 'CalculatorClient' does not contain a definition for '<method name>' and no extension method '<method name>' accepting a first argument of type 'CalculatorClient' could be found (are you missing a using directive or an assembly reference?)

  6. Compiling the client application: The type or namespace name 'CalculatorClient' could not be found (are you missing a using directive or an assembly reference?)

  7. Unhandled Exception: System.ServiceModel.EndpointNotFoundException: Could not connect to https://localhost:8000/ServiceModelSamples/Service/CalculatorService. TCP error code 10061: No connection could be made because the target machine actively refused it.

I am unable to find the project files on my hard drive.

Visual Studio saves project files in c:\users\<user name\Documents\Visual Studio 2010\Projects in Windows Vista and Windows°7, and c:\Documents and Settings\<user name>\My Documents\Visual Studio 2010\Projects in earlier versions of Windows.

Attempting to run the service application: HTTP could not register URL http://+:8000/ServiceModelSamples/Service/. Your process does not have access rights to this namespace.

The process that hosts a WCF service must be run with Administrative privileges. If you are running the service from inside Visual Studio 2010 you must run Visual Studio 2010 as an Administrator. To do so click Start, right-click Visual Studio 2010 and select Run As Administrator. If you are running the service from a command-line prompt you must start the command line prompt as an Administrator in a similar way. Click Start, right-click Command Prompt and select Run As Administrator.

Attempting to use the Svcutil.exe tool: 'svcutil' is not recognized as an internal or external command, operable program or batch file.

Svcutil.exe must be in the system path. The easiest solution is to use the Command Prompt. Click Start, select All Programs, Visual Studio 2010, Visual Studio Tools, and Visual Studio 2010 Command Prompt. This command prompt sets the system path to the correct locations for all tools shipped as part of Visual Studio 2010.

Unable to find the App.config file generated by Svcutil.exe.

The Add Existing Item dialog only displays files with the following extensions by default: .cs, .resx, .settings, .xsd, .wsdl. You can specify that you want to see all file types by selecting All Files (*.*) in the drop down list box in the lower right corner of the Add Existing Item dialog box.

Compiling the client application: 'CalculatorClient' does not contain a definition for '<method name>' and no extension method '<method name>' accepting a first argument of type 'CalculatorClient' could be found (are you missing a using directive or an assembly reference?)

Only those methods that are marked with the ServiceOperationAttribute are exposed to the outside world. If you omitted the ServiceOperationAttribute attribute from one of the methods in the ICalculator interface you get this error message when compiling a client application that makes a call to the operation missing the attribute.

Compiling the client application: The type or namespace name 'CalculatorClient' could not be found (are you missing a using directive or an assembly reference?)

You get this error if you do not add the Proxy.cs or Proxy.vb file to your client project.

Running the client: Unhandled Exception: System.ServiceModel.EndpointNotFoundException: Could not connect to https://localhost:8000/ServiceModelSamples/Service/CalculatorService. TCP error code 10061: No connection could be made because the target machine actively refused it.

This error occurs if you run the client application without running the service.

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with 'https://localhost:8000/ServiceModelSamples/Service/CalculatorService' for target 'https://localhost:8000/ServiceModelSamples/Service/CalculatorService' failed

This error occurs on a domain-joined computer that does not have network connectivity. Either connect your computer to the network or turn off security for both the client and the service. For the service, modify the code that creates the WSHttpBinding to the following.

// Step 3 of the hosting procedure: Add a service endpoint
selfHost.AddServiceEndpoint(typeof(ICalculator), new WSHttpBinding(SecurityMode.None), "CalculatorService");

For the client, change the <security> element under the <binding> element to be the following:

<security mode="None" />

See Also

Concepts

WCF Troubleshooting Quickstart
Troubleshooting Setup Issues

Other Resources

Getting Started Tutorial