2012-09-12 73 views
0

將WCF服務部署到坐在WinServer2008標準SP2上的IIS7服務器。WCF部署奇怪的合同行爲

DataContract INT成員被「丟失」

即由客戶端發送的所有整數脫穎而出,0到合同處理邏輯

我做了一個反思的合同在服務器上(以進入INT轉它串並返回它)。當測試工具指向在IDE中運行的WCF Contract時,ints會反映OK。當它指向已部署的合同時,零被反映出來。

部署: 在服務器上創建IIS應用程序,並將文件部署到物理目錄。

已部署的服務顯示正常。即真正的客戶端應用程序(VS2008 WinMobile 6.5應用程序正在開發獨立解決方案)具有WebService引用,可以看到已部署的WCF「正常」。只是客戶端生成的變量值在線路上丟失了。只發生在客戶端生成的變量。客戶端能夠使用服務器生成的DataContract變量和預期值。這與基本類型有關。第一個受害者是客戶端生成日期,因此我將這些日期轉換爲字符串。 Web.config如下。 感謝 鮑勃

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0"/> 
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> 
    </system.web> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove  the metadata endpoint above 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="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

回答

0

刪除從生產服務器上的Web應用程序並改過。問題部分解決。測試窗口應用程序現在可以看到反射的整數。但是,WinMobile客戶端仍然沒有。測試使用字符串值的合同,它的作品。這樣的生活太短暫了。我將把合同改爲字符串字符串。非常適合強類型的數據合同。