2013-01-16 56 views
1

基本上ive跟着這個教程here使用wshttpbinding通過互聯網使用WCF服務?

並擁有一切和運行,並正常工作我的本地機器。我已經將它部署在IIS中,並允許必要的防火牆端口關閉,然後轉到駐留在不同域中的客戶端PC。

我啓動了這臺機器上的WCF測試客戶端,並在WSDL的URL中鍵入,我能夠查看服務調用沒有問題。唯一的事情是,當我真正嘗試使用的方法和歡送我的價值觀,我得到以下響應

「打電話的是未經過身份驗證由服務」

奇怪 - 即使它仍然本地工作就不會在另一臺機器上工作。有什麼特定的方式來配置基於什麼即時消息做客戶?

這裏是我的web.config

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="WCF33.Service1"> 
     <endpoint address ="" binding="wsHttpBinding" contract="WCF33.IService1" /> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8080/WCF33/Service1/" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    <!-- 
     To browse web app root directory during debugging, set the value below to true. 
     Set to false before deployment to avoid disclosing web app folder information. 
     --> 
    <directoryBrowse enabled="true"/> 
    </system.webServer> 

</configuration> 

我跟着教程通過在郵件標題中的一個關鍵並驗證基於這一點,但沒有那這個問題。我認爲它與wshttp綁定有關,但我確實需要這種類型的加密。

誰能給我如何解決這個請:)

回答

0

好吧,我現在有這個排序,我有這個問題的兩個主要問題,這個問題實際上最終成爲我的第一個障礙。

隨着wshttpbinding我不得不以編程方式配置客戶端,創建一個wshttpbinding並將其附加到服務的實例。我也必須通過Windows憑據。一旦我這樣做,來電者被認證消息消失。

錯誤的下一個階段是application/xml錯誤,其中預期的響應不符合soap 1.2格式。這很奇怪,因爲即使綁定服務器端是wshttp,但由於某種原因,它在部署時默認爲basichttp。爲了解決這個問題,在wcf config editor中有一個映射部分,您可以將協議映射到綁定。在這裏,http設置爲basichttp,只需將其更改爲wshttp即可。:)

希望這可以幫助某人,因爲這兩個錯誤似乎無處不在,根本沒有答案!

0

我跟着教程通過在郵件標題中的一個關鍵並驗證基於這一點,但沒有那這個問題的任何信息/諮詢。

您是否在通話中傳遞密鑰?如果您正在運行的代碼正在期待認證頭中的某些內容,並且不存在可能導致該錯誤返回的錯誤。

+0

是的,我通過它期待SEC00001,否則返回將是「您不被允許訪問此服務」 – JazziJeff