[英]Aborted error message in WCF service
I've got a windows service hosting WCF, with its bindings configured as follows: 我有一个托管WCF的Windows服务,其绑定配置如下:
<bindings>
<netTcpBinding>
<binding name="BindingReliableMessaging" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="23:59:59"/>
</binding>
</netTcpBinding>
</bindings>
The client that connects has similar binding on it. 连接的客户端具有类似的绑定。
I'm using a subscription method to send out messages, this is this broadcast code: 我正在使用一种订阅方法来发送消息,这是以下广播代码:
public void NotifyServer(EventDataType eventData)
{
lock (locker)
{
var inactiveClients = new List<string>();
// Broadcast to all the clients bar the one sending it
//
foreach (var client in clients)
{
if (client.Key != eventData.ClientName)
{
try
{
// Send the message to the current client
//
client.Value.BroadcastToClient(eventData);
}
catch (Exception)
{
// If we can't access the current clients callback method,
// we add them to the inactive clients list, as they've probably lost their connection.
//
inactiveClients.Add(client.Key);
}
}
}
if (inactiveClients.Count > 0)
{
// Remove any clients that we couldn't get to
//
foreach (var client in inactiveClients)
{
clients.Remove(client);
}
}
}
}
This has been in use for quite some time, just recently the messages being sent have gotten bigger (now about 113K) and I'm getting the following error message: 这已经使用了一段时间了,最近才发送的消息越来越大(现在约为113K),并且我收到以下错误消息:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it has been Aborted.
I have the sizes all maxed out as well as the timeouts and the clients have not dropped off. 我已经将所有大小都最大化,并且超时了,客户端也没有中断。 Any suggestions as to the cause?
关于原因有什么建议吗?
Rob 抢
As Requested, here are the config files: 根据要求,以下是配置文件:
Client 客户
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ARIA.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="AriaClient.Log" />
<param name="AppendToFile" value="true" />
<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="20" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date (#%property{pid}) [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IBroadcasterService" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="23:59:59"/>
</binding>
<binding name="NetTcpBinding_IMathsEngineService">
<reliableSession enabled="true" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://MARSH:8080/MetricBroadcast" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IBroadcasterService" contract="MetricBroadcast.IBroadcasterService"
name="NetTcpBinding_IBroadcasterService">
<identity>
<userPrincipalName value="s_aria@racing.lc" />
</identity>
</endpoint>
<endpoint address="net.tcp://MARSH:8088/MathsEngine" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IMathsEngineService" contract="MathsEngineService.IMathsEngineService"
name="NetTcpBinding_IMathsEngineService">
<identity>
<userPrincipalName value="s_aria@racing.lc" />
</identity>
</endpoint>
</client>
</system.serviceModel>
<connectionStrings>
<add name="AriaEntities" connectionString="metadata=res://*/Model.Aria.csdl|res://*/Model.Aria.ssdl|res://*/Model.Aria.msl;provider=System.Data.SqlClient;provider connection string="data source=MARSH\SQL2012;initial catalog=Aria;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="AMSEntities" connectionString="metadata=res://*/Model.AMS.csdl|res://*/Model.AMS.ssdl|res://*/Model.AMS.msl;provider=System.Data.SqlClient;provider connection string="data source=BIC-SVR-AMS1;initial catalog=ToroRossoAMS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<applicationSettings>
<ARIA.Properties.Settings>
<setting name="MedusaPath" serializeAs="String">
<value>\\bic-svr-aria01\Medusa</value>
</setting>
<setting name="LogHeartbeat" serializeAs="String">
<value>False</value>
</setting>
<setting name="UseRepository" serializeAs="String">
<value>False</value>
</setting>
</ARIA.Properties.Settings>
</applicationSettings>
</configuration>
Service 服务
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MetricBroadcast.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="MetricBroadcast.Log" />
<param name="AppendToFile" value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="100" />
<maximumFileSize value="100MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
</log4net>
<connectionStrings>
<add name="MetricBroadcast.Properties.Settings.TargetConnectionString"
connectionString="Data Source=BIC-SVR-TSTARIA01\SQL2012;Initial Catalog=Aria;Persist Security Info=True;User ID=XXXXXX;Password=XXXX" />
</connectionStrings>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="BindingReliableMessaging" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="23:59:59"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="BroadcasterServiceBehavior" name="MetricBroadcast.BroadcasterService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="BindingReliableMessaging" contract="MetricBroadcast.IBroadcasterService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://BIC-SVR-TSTARIA01:8080/MetricBroadcast" />
</baseAddresses>
</host>
</service>
</services>
<!-- A behavior definition -->
<behaviors>
<serviceBehaviors>
<behavior name="BroadcasterServiceBehavior">
<serviceMetadata httpGetEnabled="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<applicationSettings>
<MetricBroadcast.Properties.Settings>
<setting name="LogXML" serializeAs="String">
<value>True</value>
</setting>
</MetricBroadcast.Properties.Settings>
</applicationSettings>
</configuration>
OK, its time for a bit of a red face - it turned out I was editing the wrong config file - its been set up for debug and release environments and I was editing the core one which gets overwritten when compiled. 好吧,它的时间有些面红了-原来我在编辑错误的配置文件-它是为调试和发布环境设置的,而我正在编辑的核心文件在编译时会被覆盖。
Doh. h
I'll be in the corner with a pointy hat on. 我会戴上尖尖的帽子在角落里。
Rob 抢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.