Click to See Complete Forum and Search --> : [RESOLVED] Excel COM Automation PROBLEM in browser
denvercr
Jan 19th, 2007, 01:11 AM
Hi guys,
I dont know if im in a right section to discuss my problem. Apoligize to all of you if ever..
I have this excel COM automation I created which will load an excel application when clicking a button from a browser. It executed properly when my web browser is in localhost. But when I deployed it in a server and pressing a button from a browser, an unknown javascript message alert appeared with no message indicated, hence the excel application failed to load from a client pc. Is there anything I can do about this? is there any authentication needed in a server or client to load excel application properly?.. thank you guys for your assistance.. :)
tommygrayson
Jan 19th, 2007, 01:48 AM
Hi guys,
I dont know if im in a right section to discuss my problem. Apoligize to all of you if ever..
I have this excel COM automation I created which will load an excel application when clicking a button from a browser. It executed properly when my web browser is in localhost. But when I deployed it in a server and pressing a button from a browser, an unknown javascript message alert appeared with no message indicated, hence the excel application failed to load from a client pc. Is there anything I can do about this? is there any authentication needed in a server or client to load excel application properly?.. thank you guys for your assistance.. :)
You can post the code found in the HTML part of the Designer.
denvercr
Jan 19th, 2007, 02:22 AM
hi,
im thinking of this COM reference: c:\program files\microsoft office\office11\EXCEL.EXE.. maybe the EXCEL.EXE file from the server is not compatible with Interop.Excel.dll which I referenced from my local.. is this matter? do i need to copy the EXCEL.EXE from my pc and overwrite EXCEL.EXE from the server?
tommygrayson
Jan 19th, 2007, 02:31 AM
hi,
im thinking of this COM reference: c:\program files\microsoft office\office11\EXCEL.EXE.. maybe the EXCEL.EXE file from the server is not compatible with Interop.Excel.dll which I referenced from my local.. is this matter? do i need to copy the EXCEL.EXE from my pc and overwrite EXCEL.EXE from the server?
No you need not copy Excel.exe but install Microsoft Excel 2003 on that server. Of course you have to verify it first if installed.
denvercr
Jan 19th, 2007, 03:36 AM
Its already installed in the server (analeah) same version with in my pc. Microsoft Excel 2003
tommygrayson
Jan 19th, 2007, 03:44 AM
Its already installed in the server (analeah) same version with in my pc. Microsoft Excel 2003
Try to restart the computer you wish to run on or look EXCEL.exe in the task manager and end its process.
denvercr
Jan 21st, 2007, 09:19 PM
hi,
I tried to restart the server but still not working. I tried to include a tag line in web.config file: <identity impersonate="true" username="anonymous"> but still not working. still have idea on this?
tommygrayson
Jan 22nd, 2007, 01:15 AM
hi,
I tried to restart the server but still not working. I tried to include a tag line in web.config file: <identity impersonate="true" username="anonymous"> but still not working. still have idea on this?
Remove the username="anonymous" because by default it is "" and it will accept all users.
Is there an error message popping up? Can you tell me what is the error?
denvercr
Jan 22nd, 2007, 01:30 AM
there is a an error dialog popping up but no message. here is the error message when i run the webpage in the server (analeah) itself.
// ERROR MESSAGE FROM A BROWSER
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.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 the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous 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 the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 128:
Line 129:
Line 130: excelApp = new Excel.ApplicationClass();
And I also adjusted the permission in EXCEL.EXE in the server (analeah) to allow "anonymous name" at this Tools:
Administratrive Tools>>Component Services>>Computers>>My Computers>>DCOM confi\Microsoft Excel Application
still not working bro.. thanks for the help.
tommygrayson
Jan 22nd, 2007, 01:38 AM
You should allow the ASPNET accout or IUSR_<computer name> account. in the folder security so that the computer can read the Excel dll.
Plus open the .NET Framework Configuration Wizard and allow the Excel dll assembly in the .NET Security.
denvercr
Jan 22nd, 2007, 01:45 AM
i already permitted the anonymous name: "ANALEAH\IUSR_DHL-730WJ6YR3EA" from the server (analeah) or maybe I did a wrong thing..
where is the folder security located? is it in the path DCOM configuration?
How and where I can possibly open .NET Framework Configuration Wizard>> .NET Security?? is it in my local pc or the server? (analeah) . pls type the path thanks!
tommygrayson
Jan 22nd, 2007, 01:52 AM
i already permitted the anonymous name: "ANALEAH\IUSR_DHL-730WJ6YR3EA" from the server (analeah) or maybe I did a wrong thing..
Have you assigned it to full control?
Maybe it is just read permission so that the program can not generate Excel reports.
tommygrayson
Jan 22nd, 2007, 01:55 AM
where is the folder security located? is it in the path DCOM configuration?
No, it is not in the DCOM configuration. DCOM is for asp only not .NET.
The folder security I am referring to is when you right click the folder on the window explorer. You can see a security tab there.
Add the IUSR, IWAM, ASPNET accounts there.
denvercr
Jan 22nd, 2007, 01:58 AM
here is what I did for security tab: where the user name I allowed is:
Internet Guest Account(ANALEAH/IUSR_DHL-730WJ6YR3EA)
I checked the following boxes for Permissions for Internet Guest Account:
Local Launch (checked)
Remote Launch (checked)
Local Activation (checked)
Remote Activation (checked)
Maybe this is what you mean to "full control".. or there should be a box indicating "full control"..
tommygrayson
Jan 22nd, 2007, 01:59 AM
No, it is not in the DCOM configuration. DCOM is for asp only not .NET.
The folder security I am referring to is when you right click the folder on the window explorer. You can see a security tab there.
Add the IUSR, IWAM, ASPNET accounts there.
I will say it again. Please read the above.
denvercr
Jan 22nd, 2007, 02:04 AM
I see. folder of what? is it the folder where the EXCEL.EXE located?
(C:\Program Files\Microsoft Office\OFFICE11\Excel.exe) is it \OFFICE11\ folder? what path?...
tommygrayson
Jan 22nd, 2007, 02:07 AM
I see. folder of what? is it the folder where the EXCEL.EXE located?
(C:\Program Files\Microsoft Office\OFFICE11\Excel.exe) is it \OFFICE11\ folder? what path?...
Your project folder. The whole project folder.
Or you could say the whole web site folder.
denvercr
Jan 22nd, 2007, 02:11 AM
in server (analeah ) IIS? or in this literal folder: (C:\Inetpub\wwwroot\CS\PSDSM\Default.aspx) is it \CS\ folder? thanks.
tommygrayson
Jan 22nd, 2007, 02:12 AM
in server (analeah ) IIS? or in this literal folder: (C:\Inetpub\wwwroot\CS\PSDSM\Default.aspx) is it \CS\ folder? thanks.
The literal folder C:\Inetpub\wwwroot\CS\PSDSM if PSDSM is the name of the project.
denvercr
Jan 22nd, 2007, 02:26 AM
how wud i know the project name? is it what I declare in IIS?..
let say the right folder is /CS/, will i do this sequence: right click /CS/ folder >> click properties >> click Security tab >> click Advanced button >> click Edit button>> and refer to "USR" (internet guess account). is this right? thanks
tommygrayson
Jan 22nd, 2007, 02:59 AM
let say the right folder is /CS/, will i do this sequence: right click /CS/ folder >> click properties >> click Security tab >> click Advanced button >> click Edit button>> and refer to "USR" (internet guess account). is this right? thanks
1. Right Click CS
2. Click Properties
3. Click Security Tab
4. Click Add Button
5. Click Advanced
6. Click Find Now
7. Locate and click the IUSR_<computer name> account
8. Click OK
9. Click OK again.
10. Check the Full Control / Allow Checkbox.
denvercr
Jan 22nd, 2007, 03:06 AM
I did it.. but still aint workin... :(
tommygrayson
Jan 22nd, 2007, 03:09 AM
Have you included ASPNET, IUSR_<computer name> and IWAM_<computer name>?
If so then restart IIS.
denvercr
Jan 22nd, 2007, 03:12 AM
what is that ASPNET??? U mean I will restart the server or stop and start IIS?
tommygrayson
Jan 22nd, 2007, 03:15 AM
what is that ASPNET??? U mean I will restart the server or stop and start IIS?
ASPNET is ASPNET. You can find it just like you found IWAM and IUSR.
Stop and Start IIS.
denvercr
Jan 22nd, 2007, 03:48 AM
is ASP.NET Machine Account?? how could I create a user name like this if not available yet?
tommygrayson
Jan 22nd, 2007, 03:51 AM
is ASP.NET Machine Account?? how could I create a user name like this if not available yet?
Yup. If it is not found then tell me we will proceed to the next step.
denvercr
Jan 22nd, 2007, 03:56 AM
it is not found yet. by the way im adjusting it on the server side (analeah) not in my local pc. am i doin right?..
what I will do is create a user like this?: ANALEAH\ASPNET then press ok? then set the permission to full control?
tommygrayson
Jan 22nd, 2007, 04:04 AM
it is not found yet. by the way im adjusting it on the server side (analeah) not in my local pc. am i doin right?..
what I will do is create a user like this?: ANALEAH\ASPNET then press ok? then set the permission to full control?
No you can't create ANALEAH/ASPNET. ASPNET is a system generated account.
Add these under your Web.config in the <system.web> section
<authentication mode="Windows"/>
<identity impersonate="true"/>
In order for identity impersonate to work you must set authentication mode to Windows.
denvercr
Jan 22nd, 2007, 04:14 AM
ok I typed it as is. whats next?.. will i transfer it to the server's inetpub?
tommygrayson
Jan 22nd, 2007, 08:54 PM
ok I typed it as is. whats next?.. will i transfer it to the server's inetpub?
Yes. transfer it.
denvercr
Jan 22nd, 2007, 09:07 PM
I already transfered it. No error message popping up anymore however the excel application is not appearing on the client, hence when I check the server alot of EXCEL.EXE are running behind. (when you view it in task manager). How do I make the excel application load on the client. thanks tom!
Note. excel application visibility is already set to "true"
tommygrayson
Jan 22nd, 2007, 09:19 PM
I already transfered it. No error message popping up anymore however the excel application is not appearing on the client, hence when I check the server alot of EXCEL.EXE are running behind. (when you view it in task manager). How do I make the excel application load on the client. thanks tom!
Note. excel application visibility is already set to "true"
Good. Now Excel is now running in the background. It means that it can manipulate data in the background.
The problem is that Excel files wil be visible on the server not on the client.
What does this mean?
It means that the client will never know how Excel processes its data but they can only know when it is finished.
Next. You have referenced your Excel file as http://localhost/<bah,bah,bah>.xls instead of its normal C:\<bah,bah,bah>.xls so you can't make it visible.
denvercr
Jan 22nd, 2007, 09:37 PM
thanks! but how? I mean do I need to type like this: Response.write("http://analeah/cs/traicing/PDSM/givenFileName.xls")?? like that?
let say this is my excel com declaration:
private Excel.Application excelApp = null;
private Excel.Workbook workBook = null;
private Excel.Worksheet workSheet = null;
excelApp = new Excel.ApplicationClass();
workBook = excelApp.Workbooks.Add(Type.Missing);
workSheet = (Excel.Worksheet)excelApp.ActiveSheet;
workSheet.Name = "DETAILED REPORT";
workSheet.Activate();
workSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible;
excelApp .visible = True;
.... here in this line where the excel application should be loaded to client...
what code should I type here??? you can type it in vb code I will just convert it to c#.. thanks talaga.
tommygrayson
Jan 22nd, 2007, 09:48 PM
thanks! but how? I mean do I need to type like this: Response.write("http://analeah/cs/traicing/PDSM/givenFileName.xls")?? like that?
let say this is my excel com declaration:
private Excel.Application excelApp = null;
private Excel.Workbook workBook = null;
private Excel.Worksheet workSheet = null;
excelApp = new Excel.ApplicationClass();
workBook = excelApp.Workbooks.Add(Type.Missing);
workSheet = (Excel.Worksheet)excelApp.ActiveSheet;
workSheet.Name = "DETAILED REPORT";
workSheet.Activate();
workSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible;
excelApp .visible = True;
.... here in this line where the excel application should be loaded to client...[/
Again, again, again. You system will not let the client view the current processing of the Excel Application. But the system will allow the client to view the system by adding:
Response.Redirect("Client wants to view the report then he should download this first.xls.")
This will force the system to release a download message box for him to download the finished process.
denvercr
Jan 22nd, 2007, 09:59 PM
So I will just type this line of code:
Response.Redirect("excelName.xls"); ? thats it?
or since the webpage resides in a server it goes like this:
Response.Redirect("http://analeah/cs/traicing/PSDSM/excelName.xls"); ? like that??
is excelName.xls should be present first? I mean this should be a blank excel file inside a folder in a PSDSM website project?
tommygrayson
Jan 22nd, 2007, 10:03 PM
So I will just type this line of code:
Response.Redirect("excelName.xls"); ? thats it?
or since the webpage resides in a server it goes like this:
Response.Redirect("http://analeah/cs/traicing/PSDSM/excelName.xls"); ? like that??
is excelName.xls should be present first? I mean this should be a blank excel file inside a folder in a PSDSM website project?
Just Response.Redirect("excelName.xls") will do.
denvercr
Jan 22nd, 2007, 10:11 PM
ok I will try.. however, my code cannot recognize Responce.Redirect() function.. what class, namespace, system I shoud reference in my code in order to recognize Responce.Redirect?? is it System.Web.HttpResponce ? or what DLL should I reference in my code?? thanks thanks thanks!
tommygrayson
Jan 22nd, 2007, 10:17 PM
ok I will try.. however, my code cannot recognize Responce.Redirect() function.. what class, namespace, system I shoud reference in my code in order to recognize Responce.Redirect?? is it System.Web.HttpResponce ? or what DLL should I reference in my code?? thanks thanks thanks!
I don't know the equivalent of Response.Redirect in C# but I will tell you its functions purpose.
Response.Redirect is an asp classic script that automatically redirects or goes to the requested web page.
If you redirect or point the page to go to any file that is not recognized by the ISAPI as a web page, a download message box will appear as the system will assume that the programmer wants the client to download the file as it is not a web page.
Tell me if you need more clarifications on this.
denvercr
Jan 22nd, 2007, 10:45 PM
Question... How possibly the instance of Excel.Application contents be loaded in "givenName.xls" file?? with just calling response.redirect("givenName.xls")? this will might produce a blank excel file or givenName.xls must be available..
tommygrayson
Jan 22nd, 2007, 10:52 PM
Question... How possibly the instance of Excel.Application contents be loaded in "givenName.xls" file?? with just calling response.redirect("givenName.xls")? this will might produce a blank excel file or givenName.xls must be available..
Then you must process it first then save the report into a new file name and response.redirect the saved filename.
denvercr
Jan 22nd, 2007, 10:57 PM
ok i will try bro
denvercr
Jan 23rd, 2007, 09:52 PM
Hi Tom,
My EXCEL COM is now working properly thank you for your time, patience and conitinous support. I'm learning so much from you. :) till my next post again! :wave:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.