日期:2014-05-18  浏览次数:20931 次

[wcf] “System.ServiceModel.DiagnosticUtility”的类型初始值设定项引发异常。
ServiceReference1.WCFToSqlClient client;
  string baseaddress = "http://localhost:8000/WCFToSql/WCFToSql";
  EndpointAddress endpointaddress = new EndpointAddress(baseaddress);
  WSHttpBinding binding = new WSHttpBinding(SecurityMode.None)
  {
  ReaderQuotas = XmlDictionaryReaderQuotas.Max,
  MaxBufferPoolSize = 0x80000 * 2,
  MaxReceivedMessageSize = int.MaxValue
  };
  client = new WindowsFormsApplication1.ServiceReference1.WCFToSqlClient(binding, endpointaddress);//这里出错
在大部分电脑都是可以用的!但是有一些电脑电脑就会提示System.ServiceModel.DiagnosticUtility”的类型初始值设定项引发异常。
请高手帮忙看看!

------解决方案--------------------
应该是.net Framework的版本问题,我原来是 3.5 sp2,好用,我又装了sp1的一个更新,就提示同样的错误。
你在添加删除程序中,删除sp1的一个更新项,应该可以!