2010-06-02 85 views
11

我有一個WCF服務,我已經沸騰到沒有什麼,因爲這個錯誤。它把我推上了牆。這是我現在擁有的。由於「遠程服務器返回一個錯誤:(403)禁止」與WCF服務https:

一個非常簡單的WCF服務,其中一個方法返回值爲「test」的字符串。

一個非常簡單的Web應用程序,它使用服務並將字符串的值放入標籤中。

在Win 2003上使用SSL證書運行IIS 6的Web服務器。

在同一臺服務器上工作的其他WCF服務。

我發佈的WCF服務,它的HTTPS位置

我運行在VS調試模式下的Web App和它完美的作品。

我發佈的web應用程序是HTTPS WCF服務駐留在相同的SSL證書

我得到下在同一臺服務器上的位置,「遠程服務器返回錯誤:(403)禁止」

我幾乎改變了IIS中的所有設置以及WCF和Web應用程序都無濟於事。我已經比較了WCF服務中的設置,它們都是一樣的。

下面是在web.config中的WCF服務和Web應用程序的設置:

它出現的問題具有與Web應用程序做的,但我的想法。任何想法:

WCF服務:

<system.serviceModel> 
<bindings> 

<client /> 

<services> 
    <service behaviorConfiguration="Ucf.Smtp.Wcf.SmtpServiceBehavior" name="Ucf.Smtp.Wcf.SmtpService"> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://test.net.ucf.edu/webservices/Smtp/" /> 
     </baseAddresses> 
    </host> 
    <endpoint address="" binding="wsHttpBinding" contract="Ucf.Smtp.Wcf.ISmtpService" bindingConfiguration="SSLBinding"> 
     <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="Ucf.Smtp.Wcf.SmtpServiceBehavior"> 
     <serviceMetadata httpsGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" httpsHelpPageEnabled="True"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

Web應用程序:

<system.serviceModel> 
    <bindings><wsHttpBinding> 
<binding name="WSHttpBinding_ISmtpService" closeTimeout="00:01:00" 
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
    maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
<reliableSession ordered="true" inactivityTimeout="00:10:00" 
    enabled="false" /> 
<security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" 
    realm="" /> 
    <message clientCredentialType="Windows" negotiateServiceCredential="true" 
    establishSecurityContext="true" /> 
</security> 
</binding> 

<client> 


<endpoint address="https://net228.net.ucf.edu/webservices/smtp/SmtpService.svc" 
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISmtpService" 
contract="SmtpService.ISmtpService" name="WSHttpBinding_ISmtpService"> 
<identity> 
<dns value="localhost" /> 
</identity> 

</client> 
</system.serviceModel> 

回答

4

我會在這個問題上花費幾個小時後,回答我的問題。我希望這可以幫助所有其他曾經試圖解決這個問題的人在牆上擊敗對手。我們終於找到了網絡管理員並解決了這個問題。

這裏的場景和解決方案:

我們有一個生產服務器 - 一切正常。 我們有一個測試服務器 - 我們得到一個403禁止的錯誤。 本地調試工作正常。

所有設置都是相同的,所以我們認爲。

有一個設置是錯誤的。在目錄安全性選項卡下web服務的虛擬目錄的屬性中的IIS中,第二個編輯按鈕用於IP限制。我們被設置爲拒絕訪問所有IP,除了應該包含測試服務器IP的列表。測試網絡服務器的IP沒有被授予權利。它沒有權利的原因是最近從生產虛擬服務器克隆了它,並且從未調整此設置以添加測試虛擬服務器。

0

,在跳出我是你逝去的Windows標識與該消息的唯一的事情,這可能會導致權限問題,如果用戶帳戶被傳遞無權訪問WCF服務。可能需要在Web應用程序上模擬?

0

默認情況下,WCF綁定不允許匿名(no-auth)訪問。你需要modify the bindings,使它:

<wsHttpBinding> 
    <binding ...> 
     <security mode ="None"/> 
    </binding> 
    </wsHttpBinding> 
1

在我的情況下,我從另一臺機器複製了源代碼,並沒有在這裏創建虛擬目錄。一旦我去了項目屬性,並創建了虛擬目錄,它工作正常。

0

在我的情況下,我的apppool用戶由於某種原因沒有讀/寫訪問'C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files'。

0

確保您已設置compilation debug="true"

相關問題