Update service reference not working
Asked Answered
W

12

12

I'm using Visual Studio 2008 and have a WCF client working against a WCF service. They are both located in the same Visual Studio solution. After I've made a change in my WCF contract, I want to update the service reference on the client so that changes made to the contract is also made in the proxy.

My problem is that the proxy code is not re-generated.

When I select to update the service reference, the following happens:

  1. A dialog with the title "Updating service reference 'name-of-reference'" is shown. This dialog has a progress bar.
  2. The progressbar moves and the status text in the dialog is changed to "Updating configuration"
  3. The progressbar moves a bit more, and the status text is chnaged to "Configuration update complete"

The dialog doesn't show the text "Generating \something\" (can't remember the exact wording) which I would expedct.

If I delete the service reference and add it again, the proxy is properly generated. I add the service using the exact same settings as before, so I don't think it's a issue I can solve by changing the service reference configuration on the client.

One thing I suspect may be the problem is that I've renamed the default wsHttpBindings in app.config. I've also renamed the default endpoints. The reason behind this is that I need more than one endpoint and having one named 'some-default-name' and one with my own name is just confusing.

The problem with deleting the service and adding it again is that Visual Studio adds a new binding in app.config (among other things) which should not be there.

Anyone seen this problem before? Anyone knows of a solution to it?

Whaler answered 3/11, 2009 at 8:34 Comment(0)
P
8

When we have had this problem it has usually been one of these errors:

  • The size of the contract has increased, and is now so large that the WCF configuration does not allow it to be transferred.
  • A new class has been added to a WCF Interface and that class is not marked as serializable.
  • There is a compile error that stops the code from building and it therefore uses the old dll
Peculium answered 3/11, 2009 at 15:7 Comment(1)
Unfortunately none of those applies to me. When I delete the reference and add it again it works just fine. If the contract was so big or there were any errors int he WCF contract, it wouldn't work after the delete/add operation.Whaler
P
5

I've run into this problem with the following conditions:

  1. Our workstations are connected to an Active Directory domain (nearly everything uses Windows Authentication)
  2. The service reference I'm trying to update is hosted on localhost, and is running under IIS Express (so the Application Pool user is running as the developer's personal domain user account)
  3. Another developer has added or updated the reference to the project more recently than me.

The only way I have figured out how to workaround this issue is to edit the configuration.svcinfo file for that service reference (you will need to show all files for the project to see it in visual studio), locate the following section:

userPrincipalName value="[email protected]"

and change the user to my own domain user. After saving the file, I have no trouble updating the reference until another developer updates the service reference (likely using the same workaround). Unfortunately, I haven't been able to figure out a permanent solution to this issue.

Pectoralis answered 4/2, 2014 at 17:15 Comment(0)
M
4

My error was that I forgot to add the OperationContract attribute.

Messroom answered 20/7, 2012 at 15:48 Comment(1)
In my case I had it marked OperationBehavior instead. It was hiding in plain sight.Charlet
R
4

In my case the problem was that the previous developer had added the service reference using his machine name rather than localhost. So when I told Visual Studio to update, it connected to his machine, which did not have the changes. I modified the service reference files and replaced his machine name with localhost and it was able to update the reference.

Radiochemistry answered 15/10, 2012 at 21:28 Comment(0)
S
3

I had this problem too. Deleted the service reference and recreated it again.

Sporty answered 20/11, 2014 at 8:50 Comment(1)
Just to add if someone runs into my problem. The delete from Visual Studio didn't work well, I had to both delete from VS, and then from the file explorer.Dopp
P
2

My problem was that I had two methods with the same name. Everything builded fine, but I couldn't update service reference. When I tried to start just the WCF service, the error pops up.

Pavement answered 11/8, 2011 at 11:3 Comment(1)
I had this problem too. The compiler doesn't complain when you build the service project but the service reference in the consumer project won't update. I noticed that if the 'your service has been hosted' popup doesn't appear when updating then the update won't work either.Calondra
E
2

Two easy steps to solve that:

  1. Run Service, then stop it.

  2. Update service reference.

Eberhart answered 6/11, 2014 at 21:18 Comment(0)
D
1

Highlight the service as the active project, F5 to run it in VisualStudio, it will start up in the service test app. Stop debugging. Then try to update your service reference - worked for me.

Drip answered 7/10, 2014 at 11:32 Comment(1)
This worked for me, right-clicked the .svc file, clicked Browse with, selected IE. Closed the page, then updated the reference and it worked. NeillHerophilus
C
0

I know this solution is a bit late, but after trying the posted solutions with no success, this worked:

When you create a WebService, it generates a .dll file that you reference as your service reference. This .dll is (as most know) not recreated everytime you make changes to the .SVC file. You can see this if you go and view the date modified property of the web service .dll file, in my case it was three hours old!

My solution was to make appropriate changes to the service contact, save it, and re-build the project which will cause it to recreate all the .dll's reflecting the changes you made to the service contact file (.svc).

After this, update the service reference on the client app, and the changes are evident.

  • Spades
Crouch answered 18/6, 2014 at 1:59 Comment(0)
T
0

I had the same problem. Modified some of the data contracts. Tried to "Update Service Reference" and did not see the change. Dropped and re-added the service. Still didn't see the change when writing code in the client. Opened my client with Reflector and saw the service types had the change! So why was intellisense still showing old properties? Restarted Visual Studio and the modifications finally showed in intellisense.

Traumatize answered 27/5, 2015 at 18:3 Comment(0)
P
0

I had the same problem, this by me it was caused by GIT Merge Conflict, i was missing the following code from my csproj file

   <ItemGroup>
    <None Include="Service References\<SERVICE NAME>\Reference.svcmap">
      <Generator>WCF Proxy Generator</Generator>
      <LastGenOutput>Reference.cs</LastGenOutput>
    </None>
  </ItemGroup>

I have added this onder the line of Reference.svcmap

Patricia answered 9/11, 2015 at 10:20 Comment(0)
L
0

Another solution to these kinds of problems is if your namespaces get jumbled in referenced projects that both consume the service. So:

ProjectA - Consumes ServiceA

ProjectB - Consumes ServiceA, Has Reference to ProjectA

If you change ServiceA and update ProjectB, sometimes the namespaces can can change to look at ProjectA's version of the service.

Leer answered 7/1, 2016 at 19:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.