Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel on Windows Server 2003

Status
Not open for further replies.

Miclis

Programmer
Jan 27, 2005
14
NO
I have a ASP.NET application (Visual Studio 2003 - C#) where I open an Excel.Workbook. This works fine on my local PC (Windows XP), but on the webserver Windows Server 2003 it won't work.

Where I want to open an excel workbook I get an error: "Object reference not set to an instance of an object. at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)".

In my code it looks like this:
Excel.Application XL = new Excel.ApplicationClass();
XL.Visible = false;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);

I tried also:
object missingValue = Type.Missing;
Excel.Workbook WB = XL.Workbooks.Open(workbookPath,
missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue,missingValue);

On the server there is an Excel 2000 -version.
In the Taskmanager I can see that Excel has startet.

What to do?
 
Excel is not designed to be used as a server component. It is not multi-thread/multi-process aware, and if you have two web pages trying to use it simultaneously, you'll get garbage.

If you're sure you want to do this, take a look at the security settings for the ASP.NET user, to allow it to launch COM Interop applications.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Hi Miclis,

I am having the same problem - solution works fine on Win2000, but error on Win2003.

Have you got any update on this issue?

k
 
Hi Kawak,
No, I hav'nt got any update. Tried to install a new Excel on Win2003 and that did not help either.
Think it's very strange. There must be somebody out there who's using ASP.NET and Excel on Win2003?
 
You may get issues if you have different versions of Excel on your development and production servers although you don't mention if this is the case.

Other things to check are:

1) Folder permissions for the Network Service account
2) DCOM permissions

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top