【问题标题】:Add WCF Service reference fails. And VS2008 exits添加 WCF 服务引用失败。 VS2008 退出
【发布时间】:2013-06-26 03:27:40
【问题描述】:

我有一个超级简单的 WCF 服务。我使用 IIS7 在我的本地机器上托管它。

当我向我的服务添加服务引用时,Visual Studio 告诉我有一个错误。我可以单击详细信息链接,然后会弹出一个对话框:对象引用未设置为对象的实例。

我可以毫无问题地构建我的 WCF 服务,并且我的客户端应用程序也成功构建。

我什至可以使用 svcutil http://localhost/logservice/logservice.svc?wsdl 来生成客户端。

我在我的 Windows 事件日志/查看器中看到了这个错误:

.NET 运行时版本 2.0.50727.3053 - 致命的执行引擎错误 (706B7706) (80131506)

我在网上找到了一个修补程序,但无法安装...

我认为这与我添加服务引用的客户端解决方案有关。我可以使用“在解决方案中发现服务”功能添加服务参考。我只需要在其他地方的解决方案中添加一个服务引用,所以这让我发疯了。

我的 web.config 的 system.serviceModel 如下所示:

  <system.serviceModel>
<services>
  <service behaviorConfiguration="LogServiceBehavior" name="LogService">
    <endpoint address="" binding="wsHttpBinding" contract="ILogService">
      <identity>
                    <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="LogServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

【问题讨论】:

  • 我不明白这是怎么跑题的。

标签: wcf


【解决方案1】:

我已经尝试将问题从我当前的解决方案中分离出来,并引入一个完全没有复杂性的新解决方案。

  1. 在 Visual Studio 中从 WCF 服务模板创建一个新网站。
  2. 将 C# 3.5 类库项目添加到解决方案中。
  3. 构建解决方案。
  4. 在 ClassLibrary1 项目上添加服务引用,然后单击发现按钮以发现此解决方案中的 WcfService1。
  5. 您将在列表中看到 WcfService1,但是当您单击确定或尝试扩展发现的服务时,您将收到错误消息。有时 VS2008 会退出 - 没有任何提示。

我试过运行 C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg.exe -r 没有帮助。

有人遇到过这种情况吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-16
    • 1970-01-01
    • 2018-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多