首先,app.config基本上是空的。一切都在代码中完成。非常感谢任何帮助。
我收到此错误。 已超出传入邮件的最大邮件大小限额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性。
m_Host = new ServiceHost(
typeof(Service.SalesMonitorService),
new Uri(
String.Format(
"http://{0}:{1}/SalesMonitorService/Version{2}",
System.Net.Dns.GetHostEntry("").HostName,
port,
ver)));
BasicHttpBinding binding = new BasicHttpBinding();
**binding.MaxReceivedMessageSize = 2147483647**;
//maxBufferSize="567890" maxBufferPoolSize="524288"
// maxReceivedMessageSize="567890"
//binding.MaxBufferPoolSize = 2147483647;
//binding.MaxBufferSize = 2147483647;
//binding.ReaderQuotas.MaxDepth = 2147483647;
//binding.ReaderQuotas.MaxStringContentLength = 2147483647;
//binding.ReaderQuotas.MaxArrayLength = 2147483647;
//binding.ReaderQuotas.MaxBytesPerRead = 2147483647;
//binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
//binding.Security.Mode = BasicHttpSecurityMode.Message;
m_Host.AddServiceEndpoint(
typeof(ISalesMonitorService),
binding,
""
);
ServiceThrottlingBehavior throttle;
throttle = m_Host.Description.Behaviors.
Find<ServiceThrottlingBehavior>();
if (throttle == null)
{
throttle = new ServiceThrottlingBehavior();
throttle.MaxConcurrentCalls = 100;
throttle.MaxConcurrentSessions = 100;
m_Host.Description.Behaviors.Add(throttle);
}
try
{
m_Host.Open();
}