edit3:我从服务器添加了webconfig
edit2:我运行了日志,这是出现的错误消息:
已超过传入邮件(65536)的最大邮件大小配额。若要增加配额,请在适当的绑定元素.上使用MaxReceivedMessageSize属性。
由于它只用于2000条记录的测试,而不是200条的测试,所以我决定更改应用程序设置,前提是它超过了65535的标准限制。不幸的是,这并没有帮助和搜索周围,我发现在那里有另外两种类型的起源这个问题,一个是在服务本身的设置和一个在端点。
做这项服务的开发人员说,他的这一边没问题,问题只是我这边的一个设置,他曾经自己做过,但不记得了。
我在端点中添加了app配置数据,有人说,如果端点不匹配,将使用默认设置创建默认端点,从而使用65K限制。如果这就是问题所在,我该如何解决呢?
如果你需要任何额外的代码或信息,请告诉我。
编辑:我按照建议向应用程序配置添加了更改
<behaviors>
<endpointBehaviors>
<behavior name="MetadataBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<binding name="BasicHttpBinding_IMailSortService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<endpoint behaviorConfiguration="MetadataBehavior" address="http://remote-access/MailSort/MailSortService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService"
contract="MailSortServiceReference.IMailSortService" name="BasicHttpBinding_IMailSortService" />服务器上的webconfig
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="FilePath" value="\\162.27.51.43\DOWNLOAD\RPA\Mailsort\Auto" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<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"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>发布于 2011-05-05 08:08:12
解决方案是下面的app配置设置。
当通过WCF发送大型消息时,需要将以下代码添加到服务器上的web.config和本地应用程序的app.config中。这将使服务器和本地信任使用用户定义的消息大小。
包括内部的部分。
<protocolMapping>
<remove scheme="http" />
<add scheme="http" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService" />
</protocolMapping>发布于 2011-03-28 15:01:33
评论变得太大了,转而回答:
你把端点指向行为了吗?
<endpoint address="http:blah/MyService.svc" behaviorConfiguration="MyServiceBehavior". 当前配置可用于200,但不适用于2000?如果是这样,您是否可以尝试将您的服务绑定修改为下面这样的最大值,看看这是否有帮助(您也会在服务端反映相同的属性)?
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>发布于 2011-04-15 16:56:10
我不认为这篇文章启用了评论。
我不是在评论,而是回答。
根据下面的帖子,请确保您正在使用完全限定的名称空间作为服务合同。
http://forums.silverlight.net/forums/p/191589/442378.aspx
<endpoint behaviorConfiguration="MetadataBehavior" address="http://remote-access/MailSort/MailSortService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService"
contract="FullyQualifiedNamespace.IMailSortService" name="BasicHttpBinding_IMailSortService" />https://stackoverflow.com/questions/5459605
复制相似问题