【问题标题】:WCF Deploy Strange Contract behaviorWCF 部署奇怪的合同行为
【发布时间】:2012-09-12 10:40:24
【问题描述】:

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>

【问题讨论】:

    标签: wcf


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-07-13
      • 2011-01-29
      • 2014-12-31
      • 1970-01-01
      • 2021-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-09
      相关资源
      最近更新 更多