Two exceptions in C #

Source: Internet
Author: User

I. What happens when an exception occurs during the WebClient request in C?

Solution:

Start-> Run-> cmd-> ipconfig-release-> ipconfig-renew
You only need to fix the settings to solve the problem: netsh Winsock reset, and then restart the computer as prompted ..

2. The Inter-thread operation is invalid: access it from a thread that is not creating the control ""

Two solutions:

1.Add this sentence when the thread starts.

Control. checkforillegalcrossthreadcils =False;

2.Delegate

, In 05, each control has an invokerequired attribute ~

Check whether it is true. If yes, perform the invoke operation.

Note:

Because the first method simply disables the error prompt, there is still a problem of Cross-thread control calling. This may cause two threads to change the control status at the same time or cyclically, resulting in a thread deadlock.
The invoke method is a synchronous method, so the execution process is sequential, so there will be no exception.
The second method is to use a delegate to sort the method call time, but cannot achieve the effect of running two methods in parallel. The security is safe, but the function is also paid off.

III. The RPC server is unavailable. (Exception from hresult: 0x800706ba)

Run netsh FirewallSetService remoteadmin allows the firewall to allow remote logon, enable the firewall, and testProgramRunning properly.

 

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.