【问题标题】:Configure Service Reference... - Object reference is not set to an instance of an object配置服务引用... - 对象引用未设置为对象的实例
【发布时间】:2016-11-04 01:01:34
【问题描述】:

我正在与Visual Studio 2013.NET4.5 合作。

最初我是 WCF 服务使用者,但由于处理子系统的团队缺乏资源,我接管了 WCF 服务双方的开发。所以我得到了我需要调用的 WCF 服务的代码,现在尝试将其插入以在我的本地系统上调试它。

问题:我需要调用的服务可以在 localhost 上正常运行,我可以获取 wsdl 并浏览到它。

但是,当我尝试 Visual Studio 2013 'Configure Service Reference...' 并尝试将 url 从开发服务器更改为本地时,它给了我 Object reference is not set to an instance of an object 错误。

有没有人经历过类似的事情? 这是什么原因造成的? 我该如何解决?

【问题讨论】:

标签: c# wcf visual-studio-2013 .net-4.5 local


【解决方案1】:

通过删除服务引用解决了自己的问题,然后使用给定的 URL 添加新的服务引用。

【讨论】:

    【解决方案2】:

    我知道这有点晚了,但我遇到了类似的问题,我通过添加解决了这个问题 服务端点的 app.config 文件的 identity 元素。示例:

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

    对我来说,即使 userPrincipalName 的值为空,它也能正常工作:

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

    完整的端点元素:

    <endpoint address="net.tcp://localhost:9876/my-service/tcp" ... >
      <identity>
        <userPrincipalName value="" />
      </identity>
    </endpoint>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多