. NET reading Excel file error

Source: Internet
Author: User
Tags administrator password

Error content
Microsoft Office Excel cannot access the file "D:\WWWRoot\Website\Test\Excels\Test1.xls". Possible causes: The
1 file name or path does not exist. The
2 file is being used by another program.
3 The workbook you are trying to save has the same name as the currently open workbook.
Workaround:
1
1). Add impersonation through Webconfig, add Administrator privileges,
<identity impersonate= "true" username= "system administrator" password= " System administrator Password "/>
2). This allows you to start the application process, Excel, create a new Excel, export Excel, but still cannot open the server-side Excel file

2
In the component service, DOCM sets the properties of Microsoft Excel application,
because it is operating on a 64-bit system, there is no default in Component Services docom, because Microsoft Excel application is a 32 DCOM configuration, So resolve (see step three)

3
1). Start--〉 run--〉cmd
2) at the command prompt, enter mmc-32, open the 32 console
3). File menu, add Remove Snap-in--〉 Component Services
4 ). In DCOM configuration, locate Microsoft Excel application, right-click on it, and then click Properties to pop up the Microsoft Excel Application Properties dialog Box
5). Click on the "Identification" tab and select "Interactive User"
6 ). Click on the "Security" tab, click "Customize" on "Launch and Activation Permissions", then click on the corresponding "edit" button to add a "NETWORK SERVICE" user in the "Security" dialog box (note To select this computer name) and give it "local launch" and "Local activation" Permissions
7). Remain the "Security" tab, click "Customize" on "Access", then click "Edit" and add a "NETWORK SERVICE" user to the "Security" dialog box that appears, then give "Local access" permission.
4. Restart IIS, test through

If it is iis7+win2008 R2 the above properties can be modified in EXCEL application in the component service.

If the above method is still not good, then please configure it according to the following
5.

1) Windows Server x64
Create a new Folder
C:\Windows\SysWOW64\config\systemprofile\Desktop

2)

Windows Server x86

Create a new Folder

C:\Windows\System32\config\systemprofile\Desktop

My problem is solved by step 5. It's amazing, but I don't know why yet. If the tall man please explain.

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.