Configure Service Reference… - Object reference is not set to an instance of an object

六眼飞鱼酱① 提交于 2019-12-08 02:56:42

问题


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.

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.

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


回答1:


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




回答2:


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>


来源:https://stackoverflow.com/questions/29407032/configure-service-reference-object-reference-is-not-set-to-an-instance-of-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!