1. HTTP Error 500.21-internal Server error handler "Nickleecallbackhandler" has an error module "Managedpipelinehandler" in its module list
Cause: After you install the framework v4.0, IIS is enabled, causing the framework to not be fully installed
Solution: Start with all programs, accessories, right-click Command prompt, run as Administrator->%windir%\microsoft.net\framework\v4.0.30319\aspnet_ Regiis.exe-i
2. Open on the server includeexceptiondetailinfaults (from ServiceBehaviorAttribute or configure behavior from <serviceDebug>)
The exception information for WCF is returned to the client in faultexception form by default, and FaultException's key attribute reason is one of the most important information for client feedback. After the client code is called, the default faultexception returns the following message:
the server was unable to process the request due to an internal error. For more information about this error, open the Includeexceptiondetailinfaults on the server (from ServiceBehaviorAttribute or configure behavior from <serviceDebug>) To send exception information back to the client, or to check the server trace log while opening the trace for each Microsoft. NET Framework 3.0 SDK document.
depending on the hint of the exception, if you want to see the detailed exception information on the client, set the ServiceBehavior corresponding Includeexceptiondetailinfaults property to True, This is usually shown in the configuration as follows:
<serviceBehaviors> <behavior> <servicemetadata httpgetenabled= "True" httpgeturl= "/HTTP/ localhost:8733/calculateservice/"/> <servicedebug includeexceptiondetailinfaults=" True "/> < /behavior> </serviceBehaviors>
After the above settings, the client output is "try to divide by 0", this message is consistent with the original exception information, that is, the returned faultexception in the reason contains the original exception of the value of the message, However, after this processing, the service side reported the exception information directly to the client, such as some confidential information may also be exported to the client, so the exception information must be encapsulated. The most direct form is to capture the exception at the server and re-throw a faultexception
The service side of the code improvement is as follows, after the following improvements, the client is only the information is "operation failed", and the server also recorded the exception information (Includeexceptiondetailinfaults is set to false).
Try { return dividend/divisor; } catch (Exception ex) { Console.WriteLine (ex. Message); throw new FaultException ("Operation failed"); }
There will be a succession of updates, recording the learning process encountered problems, and constantly improve ...
Exam system-The problem solution when the underlying framework is released (Window7 IIS6.0) (i)