已经花了20多个小时搜索网络,仍然不能得到basichttpbinding保存时有多个记录(当记录数量很少时可以)
服务Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
<pages>
<namespaces>
<add namespace="System.Runtime.Serialization" />
<add namespace="System.ServiceModel" />
<add namespace="System.ServiceModel.Web" />
</namespaces>
</pages>
<httpRuntime executionTimeout="600" maxRequestLength="102400"/>
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="IncidentServiceBehavior" name="NewIncidentService_IService">
<endpoint address=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="IncidentServiceReference.ServiceClient" />
<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Incident"
name="" contract="IncidentServiceReference.ServiceClient" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<timeouts closeTimeout="01:10:00" />
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="01:10:00"
openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="524288" maxReceivedMessageSize="524288" transferMode="Streamed">
<readerQuotas maxDepth="524288" maxStringContentLength="524288"
maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding_Incident" maxReceivedMessageSize="524288"
useDefaultWebProxy="false">
<readerQuotas maxDepth="524288" maxStringContentLength="524288"
maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="IncidentServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="524288" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
客户端App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<system.web>
<httpRuntime executionTimeout="600"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService"
maxReceivedMessageSize="524288"
maxBufferSize="524288"
maxBufferPoolSize="524288"
receiveTimeout="01:10:00"
transferMode="Streamed"
sendTimeout="01:10:00"
closeTimeout="01:10:00"
hostNameComparisonMode="StrongWildcard"
openTimeout="01:10:00"
messageEncoding="Text"
textEncoding="utf-8"
allowCookies="false"
bypassProxyOnLocal="false"
useDefaultWebProxy="false">
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="IncidentServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="524288"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="---Removed for security-----"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="IncidentServiceReference.IService" name="BasicHttpBinding_IService" behaviorConfiguration="IncidentServiceBehavior" />
</client>
</system.serviceModel>
</configuration>
Has a 413 error - changed to streamed, now get a 400. Error from WCF Test Client
The remote server returned an unexpected response: (400) Bad Request.
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService.saveTasks(saveTasksRequest request)
at ServiceClient.IService.saveTasks(saveTasksRequest request)
Inner Exception:
The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
是的,它似乎是一个超时,任何更改都没有影响。在连接字符串中添加了超时,并且在IIS 7.0中添加了'serverruntime uploadreadaheadsize="20480000" '
如有任何想法,我将不胜感激
安德鲁可能有解决办法。
找到这个
binding name=" openTimeout="00:10:00" closeTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
在这个站点
http://www.codeproject.com/Questions/481526/Theplusremoteplusserverplusreturnedplusanplusunexp需要在任何其他basichttpbinding之前,注意没有名称。我认为这设置了默认值。已经设置了一个测试,看看它是否工作,还没有失败。我会(当时间允许时)将值从2gig更改为更低的值。
希望这对有类似问题的人有所帮助。
安德鲁