비슷한 문제로 여기에 질문을 올렸지 만 이후 바인딩 및 동작을 올바르게 수행하는 적절한 방법에 대해 더 많은 테스트와 조사를 수행했습니다. 훨씬 더 나은 이해 이제, 나는이 초라한 오류를 아직도 얻고있다. 나는 심지어 클라이언트를 거쳐 프로 그로 메틱 방식으로 바인딩을 만들었으므로 올바른 설정을 사용하고 있는지 확신 할 수 있습니다.WCF 리더 할당량 최대 문자열 내용 길이 할당량 (8192)
클라이언트 측 프로그램 :
public static UserAnalyticsFarEnd.UserAnalyticsMasterServiceClient MakeClient(string endpointUri)
{
UserAnalyticsFarEnd.UserAnalyticsMasterServiceClient client = null;
// replicate all the binding info from app.config
BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "MaxSizeBasicBinding";
// The interval of time for a connection to open, before the transport raises an exception.
binding.OpenTimeout = TimeSpan.FromMinutes(1);
// The interval of time that a connection can remain active, during which no application
// messages are received, before it is dropped. This one is NOT important.
binding.ReceiveTimeout = TimeSpan.FromMinutes(10);
// The interval of time for an operation to complete before the transport raises an exception.
// This one is important. The time here was increased so that a command to the Negotiator
// has more than the default of one minute before it times out. Given that the Negotiator
// tries 3 times on any database command, a total of 3 minutes, CBH changed this to 5 on 2/3/12.
binding.SendTimeout = TimeSpan.FromMinutes(5); // used to be 1
binding.CloseTimeout = TimeSpan.FromMinutes(1);
binding.AllowCookies = false;
binding.BypassProxyOnLocal = false;
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.MessageEncoding = WSMessageEncoding.Text;
binding.TextEncoding = System.Text.Encoding.UTF8;
binding.TransferMode = TransferMode.Buffered;
binding.UseDefaultWebProxy = true;
//int maxMessageSize = 1024 * 1024; // reasonable size w/o allocating huge amt of memory
// That 1MB was not big enough, so increase it to half the limit, 1,073,741,824
int maxMessageSize = 1024 * 1024 * 1024;
binding.MaxBufferSize = maxMessageSize;
binding.MaxReceivedMessageSize = maxMessageSize;
binding.ReaderQuotas.MaxBytesPerRead = maxMessageSize;
binding.ReaderQuotas.MaxStringContentLength = maxMessageSize;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
binding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
try
{
System.Net.AuthenticationManager.CredentialPolicy = null;
EndpointAddress endpointAddress = new EndpointAddress(endpointUri);
client = new UserAnalyticsFarEnd.UserAnalyticsMasterServiceClient(binding, endpointAddress);
//client.ClientCredentials.Windows.AllowedImpersonationLevel =
// System.Security.Principal.TokenImpersonationLevel.Impersonation;
}
catch (Exception ex)
{
throw ex;
}
return client;
}
서비스 측면 (의 Web.config) 사람이 여기 좀 도와주세요 수 있다면, 내가 일 동안 작업 한 및 수없는 것
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Configuration" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicBindingMaxLength" maxBufferSize="1073741824"
maxReceivedMessageSize="1073741824">
<readerQuotas maxDepth="1073741824" maxStringContentLength="1073741824"
maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824" />
<security mode="TransportCredentialOnly">
<!--<transport clientCredentialType="Windows" />-->
</security>
</binding>
</basicHttpBinding>
</bindings>
<service behaviorConfiguration="UserAnalyticsSvcBehaviors" name="CISE.ServiceEngine.MasterEngineProxy.Services.UserAnalyticsMasterService">
<endpoint address="" binding="basicHttpBinding" behaviorConfiguration="Behaviors.EndpointBehavior" bindingConfiguration="BasicBindingMaxLength"
contract="CISE.ServiceEngine.MasterEngineProxy.Interfaces.IUserAnalyticsMasterService">
</endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
<behavior name="UserAnalyticsSvcBehaviors">
<!-- 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"/>
</behavior>
저에게 잘 보입니다. 위에서 지정한 'maxStringContentLength'를 초과하는 문자열이 데이터에 없습니다. –
예. 나는 꽤 확신한다. 그래도 확인할 수 있습니다 – gcoleman0828