0

WCF 服务部署到位于 WinServer2008 Standard SP2 上的 IIS7 服务器。

DataContract int 成员正在“丢失”

即客户端发送的所有整数都以0出现在服务器上的Contract处理逻辑中

我制定了“反射”合同(将传入的 int 转换为字符串并返回)。当测试工具指向在 IDE 中运行的 WCF 合同时,int 反映正常。当它指向已部署的合约时,会反映零。

部署:在服务器上创建一个 IIS 应用程序并将文件部署到物理目录。

已部署的服务显示正常。即“真正的”客户端应用程序(正在开发的单独解决方案中的 VS2008 WinMobile 6.5 应用程序)有一个 WebService 参考,可以看到 Deployed WCF OK 。只是客户端生成的变量值在网络上丢失了。仅发生在客户端生成的变量上。客户端能够使用服务器生成的具有预期值的 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>
4

1 回答 1

0

从生产服务器中删除 Web 应用程序并重新制作它。问题部分解决。测试 Windows 应用程序现在可以看到反映的整数。但是 WinMobile 客户端仍然没有。使用合同的字符串值进行了测试,并且可以正常工作。生命太短暂了。我会将合同更改为字符串字符串字符串。强类型数据契约就这么多。

于 2012-09-13T00:07:28.803 回答