Catch hosting exceptions

Source: Internet
Author: User
Tags microsoft help

This or this exception exists when we call the WebService and WCF interfaces written in C # or Java,

If it cannot be captured correctly, it will cause the applicationProgramCrash.

After searching for information, I finally found the answer to the problem!

1: when calling the interface, select' Support for Common Language Runtime libraries/CLR'(Vs2005 is like this)

2: add

# Using <mscorlib. dll>
# Include <tchar. h>
Using namespace system;

3: where exceptions may occur, use

Try ()

{}

Catch (...)

{}

In this way, all hosting exceptions can be captured.

If you want to know what the exception is, use try () {} catch (exception * E ){}

If you know the exceptions, you can directly specify them in the Catch Block, such as catch (ioexception * IOE) and catch (securityexception * se)

For more information, see Microsoft Help and Support http://msdn2.microsoft.com/en-us/library/k8d11d4s.aspx.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.