求助各位大師:WCF中如何用代碼配置修改maxItemsInObjectGraph長度限制,
原代碼:
ServiceHost host = new ServiceHost(typeof(MainServer), new Uri(tcpaddress));
host.AddServiceEndpoint(typeof(IMainServer), tcpBinding, tcpaddress);
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpGetEnabled = false;
host.Description.Behaviors.Add(behavior);
host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
host.Open();
uj5u.com熱心網友回復:
微軟鏈接:【控制序列化程序】
[ServiceBehavior(MaxItemsInObjectGraph=100000)]
public class MyDataService:IDataService
{
public DataPoint[] GetData()
{
// Implementation omitted
}
}
uj5u.com熱心網友回復:
你好,我按你的方法試了還是會出錯,請賜教。錯誤提示如下:
“System.ServiceModel.CommunicationException”型別的未經處理的例外在 mscorlib.dll 中發生
其他資訊: 服務器未提供有意義的回復;這可能是由協定不匹配、會話過早關倍訓內部服務器錯誤引起的
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/17982.html
標籤:C#
下一篇:winform表單傳值
