C# WPF应用程序未更新WCF服务的超时绑定信息
我有一个解决方案,它包含一个WCF服务、一个Windows服务(托管它)和一个使用它的WPF应用程序。我有一个引用服务的“数据访问dll”。当我搜索某个服务的解决方案时,它会找到它并引用它,而不会出现任何问题,它还会为它生成app.config文件 我遇到的问题是,绑定信息并非都在更新。我的服务已配置超时,但未在本地app.config文件中生成/更新。我可以通过手动添加它们来绕过它,而且效果很好;但是,我希望能够自动更新它们 这是服务绑定的配置:C# WPF应用程序未更新WCF服务的超时绑定信息,c#,wpf,wcf,C#,Wpf,Wcf,我有一个解决方案,它包含一个WCF服务、一个Windows服务(托管它)和一个使用它的WPF应用程序。我有一个引用服务的“数据访问dll”。当我搜索某个服务的解决方案时,它会找到它并引用它,而不会出现任何问题,它还会为它生成app.config文件 我遇到的问题是,绑定信息并非都在更新。我的服务已配置超时,但未在本地app.config文件中生成/更新。我可以通过手动添加它们来绕过它,而且效果很好;但是,我希望能够自动更新它们 这是服务绑定的配置: <bindings>
<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>
这是我引用服务时生成的内容(请注意,它缺少超时):
有人知道我做错了什么/错过了什么吗
提前谢谢你
以下每个请求是服务的my 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>
您是否将“StreamingBinding”与端点关联?在“System.serviceModel”标记之间发布所有内容可能是值得的,以查看缺少的内容。
从您的帖子中可以看出,虽然您在两端都使用netTcpBinding,但它们可能不是来自同一个端点,即客户端可能只使用默认设置
<services>
<service name="ServiceName">
<endpoint binding="netTcpBinding" bindingConfiguration="StreamingBinding"
name="NetTcpEndPoint" contract="ServiceContractName" />
</service>
</services>
我更新了上述信息以显示完整的app.config文件。当我在同一个解决方案中引用服务时,客户端的服务是自动生成的
<services>
<service name="ServiceName">
<endpoint binding="netTcpBinding" bindingConfiguration="StreamingBinding"
name="NetTcpEndPoint" contract="ServiceContractName" />
</service>
</services>