2010-05-28 26 views
3

我已經使用Visual Studio 2008創建了一個非常簡單的WCF沙箱項目,其中包括:WCF調試

  • 控制檯客戶端應用程序
  • WCF服務庫,在WcfSvcHost.exe運行

我無法在Windows 7 x64系統上調試WCF服務。我收到一個彈出窗口說:

無法自動調試 「ServiceLibrary」。遠程程序 無法調試。這通常是 表示調試不是在服務器上啓用 。

該服務是Visual Studio 2008開箱即用的模板「IService1」。客戶直接調用GetData()操作,所以沒有什麼特別的。

我試着在this question的建議,這並沒有使我一個解決方案,但WCF跟蹤日誌包含一個特殊的例外:

<E2ETraceEvent> 
<System> 
<EventID>131075</EventID> 
<Type>3</Type> 
<SubType Name="Warning">0</SubType> 
<Level>4</Level> 
<TimeCreated SystemTime="2010-05-28T17:43:31.0190250Z" /> 
<Source Name="System.ServiceModel" /> 
<Correlation ActivityID="{2f5e007a-d4d0-4046-9ab5-f6384b862a4f}" /> 
<Execution ProcessName="WcfSvcHost" ProcessID="6692" ThreadID="5" /> 
<Channel /> 
<Computer>SUBSPACE</Computer> 
</System> 
<ApplicationData> 
<TraceData> 
<DataItem> 
<TraceRecord Severity="Warning"> 
<Description>Throwing an exception.</Description> 
<AppDomain>D:\PathTo\Service\bin\Debug\ServiceLibrary.dll.config</AppDomain> 
<Exception> 
<ExceptionType>System.ComponentModel.Win32Exception, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> 
<Message>The specified domain either does not exist or could not be contacted</Message> 
<StackTrace> 
at System.ServiceModel.UpnEndpointIdentity.GetUpnFromDownlevelName(String downlevelName) 
at System.ServiceModel.UpnEndpointIdentity.GetUpnFromWindowsIdentity(WindowsIdentity windowsIdentity) 
at System.ServiceModel.UpnEndpointIdentity.EnsureIdentityClaim() 
at System.ServiceModel.EndpointIdentity.get_IdentityClaim() 
at System.ServiceModel.Security.SecurityUtils.GetSpnFromIdentity(EndpointIdentity identity, EndpointAddress target) 
... 
</StackTrace> 
<ExceptionString>System.ComponentModel.Win32Exception: The specified domain either does not exist or could not be contacted</ExceptionString> 
<NativeErrorCode>54B</NativeErrorCode> 
</Exception> 
</TraceRecord> 
</DataItem> 
</TraceData> 
</ApplicationData> 
</E2ETraceEvent> 

(縮短了堆棧跟蹤和剝離一些無趣的東西,full text here

它似乎在抱怨一個域名,但我的電腦不在任何域內。我在任何地方都沒有看到上述XML中的域名,但它確實有我的電腦名稱(SUBSPACE)。任何人有任何想法可能會導致這種情況?

客戶端和服務有這在他們的端點定義,雖然我曾嘗試服用它或將其更改爲我的計算機名稱:

<identity> 
    <dns value="localhost" /> 
</identity> 

的服務和客戶端調試的時候我開始他們的個人使用調試 - 啓動新的實例,但我想的東西只是工作作爲他們應該...

回答

1

消息

<ExceptionString>System.ComponentModel.Win32Exception: 
The specified domain either does not exist or could not be contacted</ExceptionString> 

可能表明您的計算機嘗試解析「 \ username」時出現問題,並且由於某種原因,無法正確解析。

當您在工作組模式下運行時,它應該解析爲本地計算機。從命令提示符嘗試運行一個簡單的:

ping %USERDOMAIN% 

,看看是否可行。它應該嘗試ping你的本地IP。

+0

Pinging%USERDOMAIN%(=我的計算機名稱)工作正常,所以似乎沒有問題。 – Thorarin 2010-06-04 14:53:41