adding a service reference in Visual Studio 2010 seems to not work

12,676

Solution 1

Finally really solved this. as Mike Cheel said in his comment. ill reprovide the link

The problem was simple we had a common lbrary with functions. the service was a new functionality that had been attempted by someone in this common, and was still present in the one referenced by the project.

this caused the project to have 2 identical namespaces (one in the common dll and one in the service).

So, simply, build a new common dll, added it to the project and now it works perfectly.

Solution 2

I would start by deleting the whole "Service References" folder that is generated when Visual Studio is adding service reference.

Did you try it?

Share:
12,676

Related videos on Youtube

Andy
Author by

Andy

here to find and give answers

Updated on June 04, 2022

Comments

  • Andy
    Andy almost 2 years

    answer = The problem was simple we had a common lbrary with functions. the service was a new functionality that had been attempted by someone in this common, and was still present in the one referenced by the project. this caused the project to have 2 identical namespaces (one in the common dll and one in the service).

    We had a problem adding this reference at first because of the rights the service had in IIS. we fixed that problem however, when adding the reference again it seems to only partly add the reference. It does appear in the service list but not in the app config, and it can't be used (intellisense doesn't find it nor does manually typing work).

    if we try this in a diffrent project it does add perfectly and wehave tried deleting anything we can find about the reference before readding it (the subfolder, opening the project in notepad and deleting all references there) but nothing seems to work.

    when deleting and readding a diffrent service to this project in similar ways and that works and we can add it to diffrent projects in the same solution, just not in this project.

    Anyone have any idea why this could happen and possible solutions?

    EDIT: When we recreated the project in the same solution and dragged all classes etc over we can add and remove this reference as we want. although this would count as a solution i would actually like to know why things happened like they happened rather then recreate projects when things seem to get stuck. Is there a cache or something in visual studio that could cause this?

    Also at times it takes longer (or never finds it) to find the service then at other times where it does so in <1 second. the best way to get it seems to stop and start the search. not sure if it is related but it does seem like a difference between my PC and the other one we use as well.

    Edit2: we have also tried deleting the services folder, re-adding services recreates the folder and adds this reference it does not work. if we add a different service after the deletion of the folder, that reference does work. adding the reference we want to add after that does not make it work.

    Edit3: in an additional project, i can add it once where it works however deleting the reference and then re-adding it makes it so it doesn't work again. a similar reference to this one i can delete and re-add as many times as i want within the same project and it keeps working. this one reference keeps not being found when re-added after a delete and giving the "Type or namespace can't be found" error.

    We also tried changing the solution and projects GUIDs and still, it does not add the service reference correctly in the project.)

    **Edit4: When turning off the Reuse types in referenced Assemblies in Configure Service Reference.. Dialog box visual studio adds the information to the Reference.cs page leaving that page empty. unticking this box does add all references to that file and makes the service reference work.

    However i can use most of the reference, i am missing the entry point meaning i can't run it.

    this is the dialog box where i untick to be able to get a tad further.

    Print Screen of the dialog box

    • Mike Cheel
      Mike Cheel over 13 years
      This might not be the same issue but perhaps check this article: bursjootech.blogspot.com/2008/06/…
    • Andy
      Andy over 13 years
      This wasn't the problem but got me a long way, thanks.
    • Bogdan Maxim
      Bogdan Maxim over 13 years
      I see a difference: ERPFeedService/ERPFeedService.svc -> SNService/SNService.svc?wsdl
    • Bogdan Maxim
      Bogdan Maxim over 13 years
      Maybe you need to use ERPFeedService/ERPFeedService.svc?wsdl -> your svc might specifiy a non existent / external wsdl
    • Andy
      Andy over 13 years
      we have rerun the command on a diffrent pc and have coppied that over to the first one. everything works fine however more ofthen then working the service will give a server mismatch. repeating the proccess multiple times does make it work occasionally but not as often as returning a type mismatch.
  • Andy
    Andy over 13 years
    we have tried this and it does recreate the folder and populate it, it does not make the service work.
  • Shadow The Kid Wizard
    Shadow The Kid Wizard over 13 years
    @Andy - hmm..... try deleting the .suo file from the disk (solution must be closed) and see if it helps, maybe it save some sort of cache. Long shot but who knows.. :)
  • Andy
    Andy over 13 years
    i tried deleting the suo file together with all other files but still, it does not seem to be fully adding the service reference. Interesting note, although the service reference gets added in the service reference folder, it is not in the object explorer unlike when we add the reference correctly to a diffrent project for the first time.
  • Shadow The Kid Wizard
    Shadow The Kid Wizard over 13 years
    @Andy: weird.. and is there anything different in that particular service? Maybe special data type that's causing this havoc?
  • Andy
    Andy over 13 years
    It is a service with alot of data, but further then 3 enumerators and loads of Strings/Int32s it doesn't go anywhere special. Also the first time i add it to a new project it works perfectly, just, not replaceable or updateable.