Excel operation Server Configuration

Source: Internet
Author: User

§ Error:

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

Exception details: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 an applicationProgramNo base process ID used for simulation (usually {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.

 

§ Analysis:
It always works normally in the Visual Studio environment, but this error occurs when the project is deployed to IIS.

In the exception details, "ASP. NET is not authorized to access the requested resource. Please consider granting the ASP. NET Request identity the permission to access this resource" basically explains the cause of the error.

In the visual studioenvironment, The asp.netprocess is webdev.webserver.exe, which has the permission to access the Office COM component and is normal. In the IIS environment, the corresponding ASP. NET process (iis5 is ASPnet, IIS6 is Network Service) does not have this access permission.

 

§ Solution:
1. Input dcomcnfg.exe at the start-up to start the component service.
2. Component Service-> Computer-> my computer-> DCOM configuration, find Microsoft Excel application, and right-click it-> properties.
3. Select "Custom" in the "launch and activation permissions" tab and edit it. Add a network service user and grant the "local start" and "Local activation" permissions to the user. For example:

4. Select "Custom" in the "Security tab"> "Access Permissions" and edit it. Add a network service user and grant the "local access" permission to the user. For example:

5. Select the "Interactive User" tab ".

 

 

The problem is solved, but the new problem occurs:

§ Error:
The COM Object of the type "Microsoft. Office. InterOP. Excel. applicationclass" cannot be forcibly converted to the interface type "Microsoft. Office. InterOP. Excel. _ application ". This operation fails because of the following error: An error occurred while loading the Type Library/DLL. (The exception is from hresult: 0x80029c4a (type_e_cantloadlibrary )).

 

§ Solution Process:
Microsoft. Office. InterOP. Excel file referenced in the program is 14, and Office 2007 is installed on the server.

After network query, the problem originated from the server's office COM component. We recommend that you fix the problem or reinstall the office.

 

@ Fix Office 2007, and the problem persists.
@ Reinstall Office 2007. the problem persists.

 

Continue searching for solutions to the problem.Article"Microsoft. Office. InterOP. Excel for Office 2007 is 12, and Microsoft. Office. InterOP. Excel for Office 2003 is 11 ".

 

@ The Microsoft. Office. InterOP. Excel file referenced by the program is adjusted to 12, but the problem persists.

 

There is no clue, and there is no way to try it.

 

@ Uninstall Office 2007 and install Office 2003. The problem is solved.

 

§ Problems found:
After testing, the Office version installed on the server has no direct correspondence with the referenced Microsoft. Office. InterOP. Excel version. When Office 2003 is installed on the server, the system runs normally regardless of the version of Microsoft. Office. InterOP. Excel that is referenced is 11, 12, or 14. When Office 2007 is installed, this error occurs in any version.

 

§ Speculative analysis:
Microsoft. Office. InterOP. Excel 11 and 12 are running at 1.1, while Microsoft. Office. InterOP. Excel 14 is running at 2.0. These three versions of DLL correspond to the office COM component provided by Office 2003.

The reference that supports the Office 2007 COM component should be later.

The above analysis is speculation and has not been tested or found an authoritative explanation.

 

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.