2011-07-31 22 views
0

我有一個Silverlight應用程序調用WCF服務(自行託管在控制檯應用程序中)的解決方案,我們將調用A調用另一個WCF服務(託管在IIS中),我們將打電話給B.ASP.NET中的WCF模擬異常

WCF服務A包含兩個標準方法和一個使用模擬和調用WCF服務B的方法。我嘗試從Silverlight調用WCF服務A時沒有問題,包括使用模擬的調用,但是當我嘗試從ASP.NET應用程序執行相同操作時,我從模擬方法調用WCF服務B時遇到以下異常:

不能loa d文件或程序集'System.IdentityModel.Selectors,版本= 3.0.0.0, Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依賴項之一。從HRESULT 異常:0x80070542

這裏是我的web.config的有關部分:

<system.serviceModel> 
    <bindings> 
     <customBinding> 
      <binding name="CustomBinding_IPrint"> 
       <binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
        maxSessionSize="2048"> 
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       </binaryMessageEncoding> 
       <httpTransport manualAddressing="false" maxBufferPoolSize="524288" 
        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Ntlm" 
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" 
        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" 
        useDefaultWebProxy="true" /> 
      </binding> 
      <binding name="WebHttpBinding_IClientAccessPolicy"> 
       <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
        messageVersion="Soap12" writeEncoding="utf-8"> 
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       </textMessageEncoding> 
      </binding> 
     </customBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:8733/ClientAppsWCF" binding="customBinding" 
      bindingConfiguration="CustomBinding_IPrint" contract="ClientApps.IPrint" 
      name="CustomBinding_IPrint"> 
      <identity> 
       <userPrincipalName value="[email protected]" /> 
      </identity> 
     </endpoint> 
     <endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_IClientAccessPolicy" 
      contract="ClientApps.IClientAccessPolicy" name="WebHttpBinding_IClientAccessPolicy" /> 
    </client> 
</system.serviceModel> 

會明白,如果有人可以幫助我了這一點。

回答

1

我不確定確切的問題,但我會盡力幫助你從類似的錯誤模擬。

這可能是一些事情:

  1. Kerberos身份驗證: 由於您服務是自託管,它發送主機crendential到服務B(上IIS)。 如果用戶登錄成功,請嘗試檢查「應用程序和安全性」選項卡上的事件查看器。看看它是否使用Kerberos或NTLM。如果它返回到Kerberos,請檢查SPN以及用戶是否被信任在Active Diretory中委派。

  2. 檢查程序集是否正確簽名。

  3. 檢查用戶(主機A)是否有權訪問正在嘗試加載的程序集。

+0

也許這會幫助縮小我的問題,但如果我跳過對服務B方法(在A服務中)的調用,它會在我嘗試從類庫引用中調用方法時引發異常。異常消息說,即使它存在於指定位置,它也不能加載類庫DLL文件。 – yosifun