VS 2010 error "Object reference not set to object instance" when adding service reference for WCF service

I have a VS2010 (RTM) solution that contains:

WCF Service Project
WCF Client Console Project
Class project for DataContracts and members
Class design for some simple classes

I successfully added the service link to the console client project and started the client. Then I did a long dev loop, changing the service again, and then updating the console help service. Then I changed the namespace and assembly names for the projects as well as .cs using the links and app.config. Of course, I missed some things because it will not be built, so I eventually deleted the project links and the service link, cleared and successfully built it.

Then I tried to add a link to the service again, he found it, but when "OK" clicked "Link to an object not installed on an object instance". Correct the answer below ...

+7
visual-studio-2010 wcf service-reference
source share
7 answers

Publishing my own fix as I could not find it anywhere else:

Stackoverflow'ing / Googling didn’t get me anywhere, so I ended up opening the solution file in notepad and found that the entry linking to my console project depended on the WCF Service project.

After I deleted this ProjectSection, I was able to add a link to the service and returned to business.

When trying to reproduce the problem, adding a service link to the project adds the project project dependency, but the service link is not deleted. I assume that the namespace change was the culprit when he did not find a link to the dependency?

+6
source share

This problem will be observed if you try to add a service link to the project, but there is an existing service link in the same project, to another project that you uploaded. For example, you can use the following steps to play:

  • Create two separate WCF service projects, Service1 and Service2
  • Create a client project and add the service link to the service in the Service1 project
  • Upload Project Service1
  • In the client’s project, try adding a link to the service in the Service2 project - you will receive the error indicated above.

Although this should not happen because the services are independent, the fix is ​​to reload the Service1 project when adding a link to Service2.

+6
source share

There is an existing project relationship between the service and the client. Right-click on Consumer Project → Project Dependencies; Uncheck the relationship between the Consumer and the Service. (This will remove any internal objects or links from the consumer)

Repeat: add a link to the service.

+2
source share

For everyone who has this problem and did not help with the above approaches: See if the user interface has some data bindings (in my case it was a datagrid control on the silverlight client) ymmv Also, if you have a service client, then the bindings in this form can probably be represented as a _Completed method, take a closer look at it to see if you have some data / parameters that should be there. Hth

+1
source share

Remove all versions of the Silver Light SDK (Silverlight, Silverlight3, etc.) and Silverlight tools from Add or Remove Programs. Reinstall the Silverlight tools that should fix the problem.

+1
source share

Delete and re-add the link to the service. Simple still worked for me.

What caused the "object reference" error was just changing the service endpoint URL from local to my dev server. There has never been this problem before at a time.

0
source share

My problem is in vs17 (the reference to the object is not installed in the instance of the object):

So, I renamed the project in vs2015, but this did not rename the folder in which the project was located. When I opened it in vs2017 and tried to declare a WCF service, after clicking OK I would get a ref object not found.

My fix:

So, I unloaded the project file from the solution and renamed the project folder according to the project file, reloaded the project into my solution in vs2017, now I can "Add WCF service"!

0
source share

All Articles