问题描述
我们正在wpf应用程序中使用wpf服务,并且正在使用net tcp绑定.当我们在服务器上进行更改后上传web.config时,wpf应用程序将调用该服务,而当我们关闭应用程序并再次运行时,则不会调用该服务 返回,没有任何错误提示.我对这个问题很困惑.在本地运作良好.请查看我的web.config文件-
We are consuming wpf service in the wpf application and we are using net tcp binding. When we uploading web.config after changes on the server then wpf application call the service and when we closing application and running again then service does not call back and no any error raising. I am very confused related to this problem. Locally is working very well. Please see my web.config file-
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"></customErrors>
</system.web>
<system.net>
<defaultProxy>
<proxy autoDetect="True"/>
</defaultProxy>
</system.net>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
listenBacklog="10"
maxBufferPoolSize="524288"
maxBufferSize="65536"
maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32"
maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true"
inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="WidgetsAppService.SessionsController">
<endpoint address="SessionsController" binding="netTcpBinding" contract="WidgetsAppService.Interfaces.ISessionsController" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://45.35.48.186:8002"/>
</baseAddresses>
</host>
</service>
<service name="WidgetsAppService.ServiceWithCallback">
<endpoint address="ServiceWithCallback" binding="netTcpBinding" contract="WidgetsAppService.Interfaces.IServiceWithCallback" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://45.35.48.186:8002"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
请指导我代码中的问题是什么.
Please guide me what is the problem in my code.
推荐答案
您是说您的服务托管在WPF中,而客户端由WPF使用吗?
何时发生此问题?修改了web.config后,您的服务在服务和客户端之间就永远无法工作吗?
>>>服务不会回叫,也不会引发任何错误.
您的客户端调用服务方法是否正确,服务不能调用客户端回调,或者客户端和服务都不能调用彼此的方法?
基于您的web.config,有两个服务,即WidgetsAppService.SessionsController和WidgetsAppService.ServiceWithCallback.两者都是由Duplex服务实现的吗?如果您可以与我们分享您的简单项目,将对您有所帮助 可以重现您的问题.
Based on your web.config, there are two services, WidgetsAppService.SessionsController and WidgetsAppService.ServiceWithCallback. Both of them are implemented by Duplex services? It would be helpful if you could share us your simple project which could reproduce your issue.
对于WCF中具有NetTcpBinding的双工服务,建议您参考以下链接:
WCF中的#Duplex服务
http://www.codeproject.com /Articles/660479/WCF中的Duplex-Service-in-WCF
最好的问候
爱德华
这篇关于wpf的WCf双工回拨问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!