2008-09-27 76 views
0

我有一個超級簡單的WCF服務。我使用IIS7將其託管在本地計算機上。添加WCF服務引用失敗。和VS2008退出

當我向服務中添加服務引用時,Visual Studio告訴我存在錯誤。我可以單擊詳細信息鏈接,並打開一個對話框,指出:未將對象引用設置爲對象的實例。

我可以構建自己的WCF服務,而且沒有問題,我的客戶端應用程序也可以成功構建。

我甚至可以使用svcutil http://localhost/logservice/logservice.svc?wsdl來生成客戶端。

我已經看到了這個錯誤在我的Windows事件日誌/查看器:

.NET運行庫版本2.0.50727.3053 - 致命的執行引擎錯誤(706B7706)(80131506)

我發現了一個修補程序在網上,但不會安裝...

我認爲這與我添加服務引用的客戶端解決方案有關。我可以使用「在解決方案中發現服務」功能添加服務refenrece。我只需要在其他地方的解決方案中添加服務參考,所以這讓我感到非常緊張。

我的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> 

+0

我不明白這是如何脫離主題。 – 2013-06-25 19:03:55

回答

1

我試圖隔離問題,離我現在的解決方案,並與完全沒有複雜的新方案。

  1. 從WCF服務模板在Visual Studio中創建一個新的Web站點。
  2. 將C#3.5類庫項目添加到解決方案。
  3. 構建解決方案。
  4. 在ClassLibrary1項目上添加服務引用,然後單擊發現按鈕以發現此解決方案中的WcfService1。
  5. 您將在列表中看到WcfService1,但是當您單擊確定,或嘗試展開發現的服務時,您將看到該錯誤。有時VS2008退出 - 沒有任何提示如此。

我試過運行C:\ Windows \ Microsoft.NET \ Framework \ v3.0 \ Windows Communication Foundation> ServiceModelReg.exe -r這沒有幫助。

有沒有人遇到過這樣的事情?