2012-08-07 49 views
4

我已經通過網絡漫遊,但dint發現任何解決方案。
現在,WCF服務在本地完美工作,而在遠程服務器上,它會爲POST調用引發401(未授權)Web異常。工作正常。WCF REST服務在本地工作正常,在遠程服務器上給出未授權(401)錯誤,而服務有匿名訪問

Implementation Details : 
On the Remote Server- 
    IIS : 6.0 
    .NET : 4.0 
    Calling App : WPF app. 

On the Local Server- 
    IIS : 7.0 
    .NET : 4.0 
    Calling App : WPF app. 

該服務具有爲web.config中的WCF休息指定的匿名訪問。 對於身份驗證我們實現了一個AuthManager類,它使用硬編碼的用戶名和密碼對請求進行身份驗證。

在調用調用者的同時添加網絡憑證。

當我打電話給當地的網絡是標題:

Authorization: Basic dG9ueXXXXXXX 

而在調用服務器:

Authorization: Negotiate TlRMTVNTUAABAAAAl4IIXXXXXXX 

這是正在尋找腥我。

下面給出是服務的Web.config:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <connectionStrings> 
    <add name="SqlServerConnectionString" connectionString="Data Source=BHUVINT\SQL2008R2;Initial Catalog=CPNS;User ID=sa;[email protected]"/> 
    </connectionStrings> 
    <system.diagnostics> 
    <trace> 
     <listeners> 
     <add name="myListener" 
        type="System.Diagnostics.EventLogTraceListener" 
      initializeData="Application" /> 
     </listeners> 
    </trace> 
    </system.diagnostics> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    <machineKey decryption="AES" decryptionKey="0CA3EFAF0F7A5E7A62681C0BF656EE0ECE31ACEE3E1023BA3FAD20EA5F199DE8" validation="SHA1" validationKey="3E4528C0FFE94A75DF02052B358BD9DE40800DD89DE62168764FF0DCE537184F0535D5D9AD66DEDC97DC1ABFF7FA540B4DFD82E5BB196B95D15FF81F75AD5328" /> 
    </system.web> 

    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="Mg"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     <behavior name=""> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="Mg" name="ApmWcfServiceWebRole.Push"> 
     <endpoint binding="webHttpBinding" name="firstBinding" contract="ApmWcfServiceWebRole.IPushService" /> 
     </service> 
     <service behaviorConfiguration="Mg" name="ApmWcfServiceWebRole.WP7Device"> 
     <endpoint binding="webHttpBinding" name="secondBinding" contract="ApmWcfServiceWebRole.IWP7Service" /> 
     </service> 
     <service behaviorConfiguration="Mg" name="ApmWcfServiceWebRole.iOSDevice"> 
     <endpoint binding="webHttpBinding" name="thirdBinding" contract="ApmWcfServiceWebRole.IIOSService" /> 
     </service> 
     <service behaviorConfiguration="Mg" name="ApmWcfServiceWebRole.AndroidDevice"> 
     <endpoint binding="webHttpBinding" name="fourthBinding" contract="ApmWcfServiceWebRole.IAndroidService" /> 
     </service> 
    </services> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"> 
    </serviceHostingEnvironment> 

    </system.serviceModel> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    </system.webServer> 
</configuration> 

編輯: 的AuthManager是其中所述柱正在作出其特徵在於,所需要的僅檢查調用,並且這些是是那些失敗。

編輯2: 我在AuthManager中添加了一個跟蹤,憑據沒有被它接收,它獲得一個空值。似乎問題是通過憑證。

在此先感謝。

+0

您是否在iis中啓用了匿名身份驗證? – 2012-08-07 11:00:07

+0

@KirillBestemyanov - 是的。 GETs工作正常,這意味着它在這種情況下工作。 – bhuvin 2012-08-07 11:00:43

回答

2

的問題解決:

我已經啓用匿名訪問,但對Windows身份驗證啓用了檢查,我刪除,它開始工作Solution

我需要幫助過的原因爲何發生這種情況,以便在請求到達我的跟蹤時移除證書。