Export (0) Print
Expand All

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.

Problem:

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

Solution:

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

Problem:

The following error occurs when you attempt to run the service application: HTTP could not register URL http://+:8000/ServiceModelSamples/Service/. Your process does not have access rights to this namespace (see Configuring HTTP and HTTPS for details.

Solution:

The process that hosts a WCF service must be run with administrative privileges. If you are running the service from inside Visual Studio 2008 you must run Visual Studio 2008 as an Administrator. To do so click Start, right-click Visual Studio 2008 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 fashion. Click Start, right click Command Prompt and select Run As Administrator.

Problem:

The following error occurs when you attempt to use the Svcutil.exe tool: 'svcutil' is not recognized as an internal or external command, operable program or batch file.

Solution:

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

Problem:

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

Solution:

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.

Problem:

The following syntax error occurs during compilation of 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?)

Solution:

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.

Problem:

The following error occurs during compilation of the client application: The type or namespace name 'CalculatorClient' could not be found (are you missing a using directive or an assembly reference?)

Solution:

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

Problem:

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

Solution:

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

Problem:

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

Solution:

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:

// 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="Node" />


© 2007 Microsoft Corporation. All rights reserved.
Last Published: 2010-03-21
Show:
© 2014 Microsoft