2

I am working with Visual Studio 2013, .NET4.5.

Originally I was WCF service consumer but due to lack of resources in team that deals with subsystem I took over development of both sides of WCF service. So I got Code of the WCF service that I need to call and now trying to plug it in to debug it on my local system.

Issue: Service that I need to call works on localhost fine I can get wsdl and browse to it.

enter image description here However when I try in Visual Studio 2013 'Configure Service Reference...' and Try to change url from dev server to local it gives me Object reference is not set to an instance of an object error.

enter image description here

Has anyone experienced something similar? What is causing this? How do I fix it?

Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
  • Can you please show your code as a text? And [What is a `NullReferenceException` and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Soner Gönül Apr 02 '15 at 07:10
  • @SonerGönül There is no code, I am trying to configure using Visual Studio UI. – Matas Vaitkevicius Apr 02 '15 at 07:12

2 Answers2

11

Solved myself by deleting Service Reference, and then adding new Service Reference with given URL.

Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
5

I know this is a bit late but I had a similar problem and I fixed it by adding an identity element to the app.config file for the service's endpoint. Example:

<identity>
  <userPrincipalName value="username@domain" />
</identity>

The for me it worked even with an empty value for userPrincipalName:

<identity>
  <userPrincipalName value="" />
</identity>

Full endpoint element:

<endpoint address="net.tcp://localhost:9876/my-service/tcp" ... >
  <identity>
    <userPrincipalName value="" />
  </identity>
</endpoint>
Valentin D
  • 705
  • 7
  • 14