WPF应用未更新WCF服务的超时绑定信息

4
我有一个解决方案,包含一个WCF服务,一个Windows服务(用于托管它),以及一个WPF应用程序来使用它。我有一个“数据访问dll”,我正在从该服务引用它。当我搜索服务时,它会找到并引用它,而且还会生成app.config文件。
我的问题是,绑定信息没有全部更新。我的服务已配置了超时时间,但本地的app.config文件没有生成/更新。我通过手动添加解决了这个问题,现在可以正常工作;但是,我希望能够自动更新它们。
以下是服务绑定的配置:
<bindings>
      <netTcpBinding>
        <binding name="StreamingBinding" receiveTimeout="00:15:00" sendTimeout="00:15:00"
          transferMode="Streamed" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

当我引用服务时,生成的内容如下(请注意它缺少超时):

<bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_ITestService" transferMode="Streamed">
                    <security mode="None" />
                </binding>
            </netTcpBinding>
        </bindings>

有人知道我做错或者漏掉了什么吗?

提前感谢您!


根据下面的请求,这是我的服务端 app.config 和客户端 app.config:

服务端:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="StreamingBinding" receiveTimeout="00:15:00" sendTimeout="00:15:00"
          transferMode="Streamed" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service name="TestService.Wcf.TestServiceWcf">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="StreamingBinding"
          contract="TestService.Wcf.ITestServiceWcf">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8525/TestServiceService" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

客户端:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_ITestServiceWcf" transferMode="Streamed">
                    <security mode="None" />
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://localhost:8525/TestServiceService"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ITestServiceWcf"
                contract="TestServiceService.ITestServiceWcf" name="NetTcpBinding_ITestServiceWcf">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>
1个回答

0
你是否将 "StreamingBinding" 与你的端点相关联?值得检查一下在 "System.serviceModel" 标签之间的所有内容以查看缺少了什么。 从你的帖子中看来,虽然你在两端都使用了 netTcpBinding ,但它们可能不是来自同一个端点,即客户端可能只是使用默认设置。
<services>
      <service name="ServiceName">
        <endpoint binding="netTcpBinding" bindingConfiguration="StreamingBinding"
          name="NetTcpEndPoint" contract="ServiceContractName" />
      </service>
    </services>

我更新了上面的信息,以显示完整的app.config文件。当我在同一解决方案中引用服务时,客户端的配置文件是自动生成的。 - spyter

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接