The C # system. Io. filestream file is being used by another process, so the process cannot access the file.

Source: Internet
Author: User

The file is being used by another process, so the process cannot access the file

The method used to construct system. Io. filestream is incorrect.

It is directly used at the beginning.

System. Io. filestream FS = new system. Io. filestream (filename, system. Io. filemode. open)

This method is used to open a file in read-only sharing mode. However, if the file has been opened by a process with write permission, it cannot be read,

Therefore, you need to use

System. Io. filestream FS = new system. Io. filestream (filename, system. Io. filemode. Open, system. Io. fileaccess. Read, fileshare. readwrite );

Set the file sharing mode to read and write, fileshare. readwrite. In this way, you can open



Website creation-website construction-company website-product sales website-product display website-enterprise publicity website-online shop-online mall-Information Classification Website-qq471226865

Related Article

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.