解决WCF The server was unable to process the request due to an internal error的问题

 WCF部署时可能会遇到如下问题:   

  具体信息如下:

  The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the serviceDebug configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

解决方法如下:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)] 
    public class Monitor : IMonitor
    {
        public IList<VmCpuMonitor> MonitorCpu(string vmName)
        {
            IList<VmCpuMonitor> vs = (new VmMonitorServer()).GetVmCpuMonitors(vmName);
            return vs;
        }

      
    }
记得需要修改web.config配置
<client>
      <endpoint address="http://localhost/CloudCluster/Service/Monitor/VmMonitor.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMonitor"
        contract="VmMonitor_Wcf_Servers.IMonitor" name="BasicHttpBinding_IMonitor" />
      <endpoint address="http://localhost/CloudCluster/Service/VmHost/VmHost.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IVmHost"
        contract="VmHost_Wcf_Servers.IVmHost" name="BasicHttpBinding_IVmHost" />
    </client>

  

posted @ 2012-02-08 14:26  yhql_916  阅读(2152)  评论(0)    收藏  举报