Highlights about Excel import and export problems in IIS

Source: Internet
Author: User
Tags visual studio 2010
Problem description

1. Number of records generated by each sheet in Excel

2. Asp.net highlights some EXCEL export problems

3. Download failed. The temporary file or its disk cannot be written.

4. Failed to Load file or assembly "Microsoft. Office. InterOP. Excel, version = 14.0.0.0 ,**

5. An error of {00024500-00 *** occurs when an excel program is released under IIS.

6. system. componentmodel. win32exception: Access Denied

A detailed explanation of these issues.

Problem Environment

Windows server2003 and Windows 7 Operating Systems

Iis6. *, iis7 .*

Install software office2010

Detailed Solution 1. Number of records generated by each sheet in Excel

"How many pieces of data can be stored in an Excel file at most? "

2003 rows under Excel 65535 (inclusive), excel20071, and 048,576 rows

 

2. Asp.net highlights some EXCEL export problems

A cannot be downloaded: You can use the built-in ie download.

B. If Thunder is used, we recommend that you open it first and download it. Otherwise, the system prompts the disk to be occupied.

C. Set the Excel attribute in templetes/output/base to read-only. Remove the check mark.

 

3. Download failed. The temporary file or its disk cannot be written.

[Solution]

C: \ modify the Security Attribute of the temp folder in windows and grant permissions to users. Available

Or

Try to change the installation directory of Thunder: not try

4. Failed to Load file or assembly "Microsoft. Office. InterOP. Excel, version = 14.0.0.0 ,**

[Problem description] 

Failed to Load file or assembly "Microsoft. Office. InterOP. Excel, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" or one of its dependencies. The system cannot find the specified file.

Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception details: system. io. filenotfoundexception: failed to Load file or assembly "Microsoft. office. interOP. excel, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c "or one of its dependencies. The system cannot find the specified file.

Source error:

An unhandled exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception.

Assembly loading tracking: The following information helps determine why the assembly "Microsoft. Office. InterOP. Excel, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" cannot be loaded.

[Solution]

Warning assembly binding logging is disabled.

To enable the Assembly Binding failure log, set the registry value to [HKLM \ Software \ Microsoft \ Fusion! Enablelog] (DWORD) is set to 1.

Note: There will be some performance loss associated with the Assembly Binding failure log.

To disable this function, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! Enablelog].

No office is installed on the server.

After the proposal, the administrator installed office2003 (note that the computer should be restarted after installation)

According to some methods found on the internet,

Installation:

Vstor.exe

:

Http://www.microsoft.com/downloads/details.aspx? Familyid = 8315654b-a5ae-4408-b7fc-186402563f2b & DISPLAY # filelist

Then download and install:

O2003pia. exe

Http://www.microsoft.com/downloads/details.aspx? Familyid = 3c9a983a-ac14-4125-8ba0-d36d67e0f4ad & Display

Not solved later

Then

Start on the server-Program-Administrative Tools-Microsoft. NET Framework 2.0 configuration-manage Assembly Cache-Add the assembly to the Assembly Cache. Select the DLL.

Unfortunately, the problem persists.

Finally, restart IIS to solve the problem.

The specific solution is that either of the above two methods or both must be done.

I think a very important issue is

Project references must be included in the c: \ windows \ Assembly directory.

Failed to Load file or assembly "Microsoft. Office. InterOP. Excel, version = 11.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" or one of its dependencies. The system cannot find the specified file.

The principle is:

The Office file InterOP. Excel. dll referenced by the project is missing on the computer.

Vstor.exe and o2003pia. EXE are installation programs for office reusable development of XXX.

5. An error of {00024500-00 *** occurs when an excel program is released under IIS.

[Problem not described] English version

Retrieving the com class factory forcomponent with clsid {00024500-0000-0000-c000-000000000046} failed due to thefollowing error: 80070005.

Description: An unhandled exceptionoccurred during the execution of the current Web request. Please review thestack trace for more information about the error and where it originated in thecode.

Exception details: system. unauthorizedaccessexception: retrieving the com class factory forcomponent with clsid {00024500-0000-0000-c000-000000000046} failed due to thefollowing error: 80070005.

ASP. net is not authorized to access therequested resource. consider granting access rights to the resource to theasp. NET Request identity. ASP. net has a base Process Identity (typically {MACHINE} \ ASPnet on IIS 5 or network service on IIS 6) that is used if theapplication is not impersonating. if the application is impersonating via <identity impersonate = "true"/>, the identity will be theanonymous user (typically IUSR_machinename) or the authenticated request user.

 

To grant ASP. net access to a file, right-click the file in explorer, choose "properties" and select thesecurity tab. click "add" to add the appropriate user or group. highlight the ASP. net account, and check the boxes for the desired access.

[Problem description] Chinese Version

Failed to retrieve components whose CLSID is {00024500-0000-0000-c000-000000000046} in the com class factory because of the following error: 80070005.

Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception details: system. unauthorizedaccessexception: failed to retrieve components whose CLSID is {00024500-0000-0000-c000-0000000000000046} in the com class factory because of the following error: 80070005.

ASP. NET is not authorized to access the requested resources. Consider granting the ASP. NET Request identity the permission to access this resource. ASP. NET has a base process ID used when the application is not simulated (typically, {MACHINE} \ ASPnet on IIS 5 and Network Service on IIS 6 ). If the application is simulating through <identity impersonate = "true"/>, the identity will be an anonymous user (usually IUSR_machinename) or an authenticated user.

 

To grant ASP. NET access permissions to a file, right-click the file in resource manager, select "properties", and select the "Security" tab. Click Add to add an appropriate user or group. Highlight the ASP. NET account and select the corresponding access permission box.

Source error:

An unhandled exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception.

[Solution 1]

1: Install the Excel software for office on the server.

2: Enter dcomcnfg.exe in "start"-> "run" to start "Component Service"

3: Double-click "component service"> "computer"> "my computer"> "DCOM configuration"

4: Find the Microsoft Excel application in "DCOM configuration", right-click it, and click "properties ".

Application Properties dialog box

5. Click the "ID" tab and select "Interactive User"

6. Click the "Security" tab, click "Custom" on "Start and activate Permissions", and then click the corresponding "edit" button. In the displayed "security" dialog box, enter

A "Network Service" user (note that you must select the computer name), and grant it the "local start" and "Local activation" permissions.

 

7: the "Security" label is still displayed. Click "Custom" on "Access Permissions", and then click "edit". In the displayed "security" dialog box, add a "network"

Service, and then grant the "local access" permission.

In this way, we have configured the corresponding Excel DCOM permissions.

Note: This is configured on win2003. on 2000 and XP, the network service user is changed to Asp.net user.

[Solution]

. Net Excel export 80070005 error solution:

An error occurred while retrieving components whose CLSID is {00024500-0000-0000-c000-0000000000000046} in the com class factory because the following error occurs: 80070005 basically. net to export Excel files, you need to configure it like this. If it is not configured, It is correct. However, after the configuration, there should be no errors.

The configuration method is as follows:

1: Install the Excel software for office on the server.

2: Enter dcomcnfg.exe in "start"-> "run" to start "Component Service"

3: Double-click "component service"> "computer"> "my computer"> "DCOM configuration"

4. In "DCOM configuration", find "Microsoft Excel application", right-click it, and click "properties". The "Microsoft Excel application properties" dialog box is displayed.

5. Click the "ID" tab and select "Interactive User"

6. Click the "Security" tab, click "Custom" on "Start and activate Permissions", and then click the corresponding "edit" button, in the pop-up "security" dialog box, add a "Network Service" user (note that you must select the computer name) and grant it the "local start" and "Local activation" permissions.

7: the "Security" label remains. Click "Custom" on "Access Permissions", and then click "edit ", in the pop-up "security" dialog box, add a "Network Service" user and grant "local access" permission.

8. If the error 8000401a occurs after the interactive user is set, you can cancel the interactive user and set it to administratr. This problem can be solved temporarily. Further solutions are to be discussed.

9. After setting, "object reference or link cannot be used" may appear when you open an Excel file, and cell pasting is not allowed. The reason is unknown. The setting will disappear after cancellation.

 

In addition, simply following the above settings does not completely guarantee that the problem persists, because calling office operations may involve other system resources and may still cause problems due to insufficient permissions, after setting the Excel application, the system may still report a 80070005 error. The most safe thing is to select my computer in dcomcnfg and then right-click Properties> com security to grant the access permission, all the start and activation permissions are edited by default. Add network service (Asp.net user is required for IIS 5.0) to it, and set the same permissions for NetworkService as before, this basically guarantees that no problem will occur.

The above is the basic way out, but I have also encountered an error when using the above method. My environment is Windows2003 + office2003 + office2007, which can be exported on the test server without any problems! However, if the official environment is updated, an error is returned. If all permissions are set, an error is returned. Because my test server is started by the default Office, I suspect it is an office environment problem! So I uninstalled office2007 and immediately tested it. But after I restarted the server, the have not been pre-compiled error occurred, and the export page could not be opened, so I re-installed office2007 and opened the page, but an error was reported when exporting the Excel file! I reset all the permissions again. the problem persists! Later, I found that the Excel programs opened by the two servers are different by default. The test environment is opened by office2003 by default, and the official environment is opened by office2007. So I re-registered office2003 in the official environment, so that it is also the default office2003 open program, rely on! The problem is finally solved !!!

Run the registration method ---- run ---- enter the installation path of excel2003, for example, "C: \ Program Files \ Microsoft Office \ office11 \ excel.exe"/regserver note/there is a space in front of the symbol, "C: \ ProgramFiles \ Microsoft Office \ office11 \ excel.exe" is the path of the installation program of excel2003. The regserver parameter indicates registration!

After running, the installation program of Office 2003 will be started, repaired, and re-registered.

Excel2007 is the default method for starting a program. You can run ---- "D: \ ProgramFiles \ Microsoft Office \ office12 \ excel.exe"/regserver

In summary, when you encounter Excel export and import problems, consider the permission issue first, and then consider the Office version environment! This can basically solve these problems.

6. system. componentmodel. win32exception: Access Denied

[Problem description]

Access denied.

Description:An error occurred while executing the current Web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception details:System. componentmodel. win32exception: access is denied.

Source Error: 

An unhandled exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception.

Stack Tracing: 

[Win32exception (0x80004005): access is denied.] System. diagnostics. processmanager. openProcess (int32 processid, int32 access, Boolean throwifexited) + 964480 system. diagnostics. process. getprocesshandle (int32 access, Boolean throwifexited) + 396 system. diagnostics. process. getprocesstimes () + 67 system. diagnostics. process. get_starttime () + 31 hosentic. commonhelper. excelhelper. killexcelprocess () in D: \ workspaces \ Visual Studio 2010 \ hxtr \ soft_hisense_mobilesales \ hosentic. commonhelper \ excelhelper. CS: 1852 hosentic. commonhelper. excelhelper. dispose () in D: \ workspaces \ Visual Studio 2010 \ hxtr \ soft_hisense_mobilesales \ hosentic. commonhelper \ excelhelper. CS: 1897 hosentic. commonhelper. excelhelper. saveFile () in D: \ workspaces \ Visual Studio 2010 \ hxtr \ soft_hisense_mobilesales \ hosentic. commonhelper \ excelhelper. CS: 1651 seconds (httpcontext context) in D: \ workspaces \ Visual Studio 2010 \ hxtr \ soft_hisense_mobilesales \ soft_hisense_mobilesales.bll \ base \ deliverybatchoutputhandler. CS: 123 system. web. callhandlerexecutionstep. system. web. httpapplication. iexecutionstep. execute () + 181 system. web. httpapplication. executestep (iexecutionstep step, Boolean & completedsynchronously) + 75

 

[Solution]

Add a code

<Identity impersonate = "true" username = "accountname" Password = "password"/>

Add to system. Web

<System. Web>

<Identity impersonate = "true" username = "Administrator" Password = "1234568@abc.1"/>

<Customerrorsmode = "off"/>

 

<Httpruntimemaxrequestlength = "102400" executiontimeout = "720"/>

<! --

Set compilation DEBUG = "true" to insert debugging symbols

Compiled pages. Because this will

Affects performance. Therefore, set this value only during development.

Set to true.

[Internet annotation]

Two days ago, I made a project under vs2005. it was okay to debug the Web service integrated in it. However, when the project was configured under IIS, the browser browsing results were incorrect, this problem has been depressing for a day. Later, I asked my colleague to debug it without making any moves. add a sentence in config: "<identity impersonate =" true "username =" operating system user "Password =" User Password "/>", browse ..., The result is correct. Later I checked the role of this sentence on the Internet. msdn said this:
1. Account or user simulating IIS Authentication

To receive ASP. when every request on each page in the. NET application simulates the Microsoft Internet Information Service (IIS) authentication user, the web. the config file contains the <identity> flag and sets the impersonate attribute to true.

2. simulate a specific user for all requests of ASP. NET Applications

To be ASP.. NET application. specify the username and password attributes in the <identity> tag of the config file. For example:
<Identityimpersonate = "true" username = "accountname" Password = "password"/>

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.