Andy
Andy

Reputation: 2318

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

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

Upvotes: 5

Views: 12771

Answers (3)

Andy
Andy

Reputation: 2318

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.

Upvotes: 2

user376591
user376591

Reputation:

When I worked with Service References I found out that in addition to remove the Service Reference Folder I had to remove the reference in app.config, along these lines:

<system.serviceModel>
    <bindings>
    a lot of lines...
    </client>
</system.serviceModel>

Could be a help...
Gorgen

Upvotes: 2

Shadow Wizard
Shadow Wizard

Reputation: 66389

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

Did you try it?

Upvotes: 1

Related Questions