Apocatastasis
Apocatastasis

Reputation: 500

WCF service operations not updated

I´m creating a new WCF service. I initially had only three operations. But after some time I decided to add two more. This operations doesn't appear in the Microsoft test client, neither in the list of operations when I try to add a service reference from my WPF client. Also I tried to comment one of the initial operations. It still apears in the Microsoft test client and can be invoked. I Tried also delete the dlls generated by the service and regenerate again. No luck. There are some kind of "cache" where Visual Studio stores the WCF services libraries that I can delete?

UPDATE: I'm working with the service running in the ASP.NET devolopment server.

Upvotes: 2

Views: 10701

Answers (7)

Apocatastasis
Apocatastasis

Reputation: 500

I don't know why, but I created a new project and copied the definitions of the operations from the problematic project and the problem is gone. One case more for Microsoft mysteries.

Upvotes: 1

Hugo Bounoua
Hugo Bounoua

Reputation: 455

SOLUTION HERE :

Make sure your dataContract does NOT contain any enum (You can use integer instead)

Be sure to reference a project in the solution and not a dll on your disk

  1. Remove your "bin" and "obj" folders
  2. Recompile
  3. In IIS recycle the application pool
  4. In IIS restart your service
  5. In IIS "Browse" your service

=> You got it

Upvotes: 0

Muhamed Shafeeq
Muhamed Shafeeq

Reputation: 1214

Did you close the client connection in client side as showing your service

class Test
    {
        static void Main()
        {
            LocationClient client = new LocationClient();

            // Use the 'client' variable to call operations on the service.

            // Always close the client.
            client.Close();
        }
    }

Upvotes: 0

Pavel
Pavel

Reputation: 481

For me worked: just rebuild the wcf project

Upvotes: 0

Anthony Potts
Anthony Potts

Reputation: 9160

One thing we have discovered is that when you deploy the dlls that they must be in the bin, and cannot reside in the debug or release folder.

Upvotes: 0

John Saunders
John Saunders

Reputation: 161821

You need to understand the order in which things happen.

  1. You change your code, adding methods with [OperationContract] on them, or removing them, or changing their parameters or return values.
  2. You then must build your service, producing a .DLL that contains the changes.
  3. You must then deploy the changed DLL to the server it's going to run on
  4. You must then restart the service (this may happen automatically depending on the server. For instance, IIS will recycle the service when it sees that the DLL changed)
  5. You must then update your client, either the WCF Test Client, or "Add Service Reference", or the equivalent.

This last will have the effect of sending a request to the service for the new metadata or WSDL. Only then can the client see the changes you made to the definition of the service.

Upvotes: 5

tam
tam

Reputation: 1583

Make sure you are updating the services after adding the new operations.

Also make sure they have the attribute [OperationContract].

Upvotes: 0

Related Questions