2010-12-12 33 views
0

我在本地創建並測試了WCF服務,當然它工作正常。我發佈到共享的託管網站並瀏覽了wsdl,看起來沒有問題。但是當我在WP7代碼中調用該服務時,出現無用的錯誤消息。在啓用includeExceptionDetailInFaults和WCF跟蹤錯誤讀取之後。 「System.ServiceModel.ProtocolException:內容類型application/soap + xml; charset = utf-8被髮送到期望text/xml; charset = utf-8的服務,客戶端和服務綁定可能不匹配。WP7中的WCF客戶端和服務綁定可能不匹配

這裏是web.config中的部分...

<behaviors> 
    <serviceBehaviors> 
    <behavior name="SL_SeeYaThere_WCF.Web.SeeYaThereWCFBehavior"> 
    <serviceMetadata httpGetEnabled="true" /> 
    <serviceDebug httpHelpPageEnabled ="true" includeExceptionDetailInFaults="true" /> 
    </behavior> 
    <!—- other services… --> 
    </serviceBehaviors> 
</behaviors> 

<bindings> 
    <basicHttpBinding> 
    <!—- there is not a binding for this service should there be? --> 
    <!—- other services… --> 
    </basicHttpBinding> 
</bindings> 

<服務>
<服務behaviorConfiguration = 「SL_SeeYaThere_WCF.Web.SeeYaThereWCFBehavior」 NAME =」 SL_SeeYaThere_WCF.Web.SeeYaThereWCF「>
< endpoi NT地址= 「」 結合= 「basicHttpBinding的」 合同= 「SL_SeeYaThere_WCF.Web.ISeeYaThereWCF」/>
<端點地址= 「MEX」 結合= 「mexHttpBinding」 合同= 「IMetadataExchange接口」/>
< /服務>
<! - 其他服務... - >
</services>

^^ appoligize about format。編輯器不會正確顯示標記。

這是我第一次使用WFC的經歷,它並不令人愉快。我究竟做錯了什麼?

感謝您的幫助。

回答

0

好的發現了問題。在WP7應用程序中有一個具有客戶端綁定的ServicesReferences.clientConfig文件。 WCF服務有兩個端點用於本地主機,另一端用於共享託管地址。當我從本地主機配置服務引用到共享主機站點時,它一定發生了。

我將本地主機添加器更改爲共享託管地址,它工作正常。

相關問題