473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reading Excel File using ASP problem only IIS

Hi all,

I've created an asp page which is reading an Excel file, the code is working ok only not on IIS !!

here is the code:

oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=C:\inetpub\wwwroot\ads\NOS_Holidays_2007.xls; " & _
"DefaultDir=C:\inetpub\wwwroot\ads"

It's working perfectly fine on "Abyss Web Server" but not on IIS6 or IIS7

I'm getting the following Error on the IE

HTTP 500 (when using friendly Errors)

OR

An error occurred on the server when processing the URL. Please contact the system administrator

I think there is something wrong between the Excel Driver and IIS.

I would be thankful if you can help me finding what's wrong.

Thanks.
May 15 '07 #1
8 17235
Hi Here is more information:

I have the same problem in reading ACCESS database as well, also only with IIS.

The Error is details is:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Excel Driver] Disk or network error.

/ads/update_holidays.asp, line 11

here is line 11:

oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _

Thanks in Advance
May 15 '07 #2
jhardman
3,406 Expert 2GB
Try this slightly different syntax:
Expand|Select|Wrap|Line Numbers
  1. File = "ads\NOS_Holidays_2007.xls"
  2. oConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="&_
  3.    server.mapPath(File)&"; Extended Properties=Excel 8.0;"
  4.  
You also might want to try connecting with a DSN, sometimes this seems like a big hassle to me, but it does take out some of the guesswork.

Jared
May 15 '07 #3
Hi Jared,

Thanks for the reply, no luck :( now I got the following Error:

Microsoft JET Database Engine error '80004005'

Unspecified error

/ads/update_holidays.asp, line 12

here is line 12

12 oConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="&_
13 server.mapPath(File)&"; Extended Properties=Excel 8.0;"

I rolled back the changes, but is there is anything needed to prepare IIS to work with mdb and xls files? becuaes it's working ok with other webservers on the same PC.

Also I would be thankful if you can give me some links about the other method.

Thanks in Advance.
May 15 '07 #4
Hi here is the solution which I found, thanks to Bill - it works for me regardless the IIS vr.

loadUserProfile and IIS7 - understanding temporary directory failures
Posted Oct 18 2006, 08:47 AM by bills
Filed under: IIS7, Troubleshooting, Compatibility
I've noticed quite a few people running into temporary directory permission issues. The PHP blog post I made last month is one example of this issue, there are also several forum posts related to ASP & Access database failures, where the reported failure is:

Microsoft JET Database Engine error '80004005'
Unspecified error

Not a very helpful error, to be sure. It turns out all of these cases have a similar underlying cause: the effective user of the web application (including the anonymous user for unauthenticated requests) can not effectively write to the temporary directory. What changed in IIS7 and why did this always work before?

With IIS6, all worker processes, regardless of which the process identity was configured, used to C:\windows\temp as the temporary directory. More specifically, none of the worker processes loaded their 'user profile' by default, causing all of them to use c:\windows\temp as a temporary directory. Windows allows all users read/write/creator privledges on this directory, which allowed things to 'just work'. The negative side effect of this is that all AppPools are effectively sharing the same temporary directory by default, which could lead to cross-appPool information disclosure.

With IIS7, we've chosen a more secure default and now load user profile by default for all application pools. Unfortunately, the temporary directory underneath the user directory (for example - %windir%\serviceprofiles\networkservice\AppData\Lo cal\Temp for the default NetworkService identity we use for DefaultAppPool) is not writable by anyone other than NetworkService by default.

There are two ways to workaround this. First, I recommend that ACL the NetworkService temporary directory to allow whichever users read/write/creator privs that you want to allow access so that you still have the benefits of loading a user profile and separating temp directories per appPool. This can easily be done on the command line like this:



icacls %windir%\serviceprofiles\networkservice\AppData\Lo cal\Temp /grant Users:(CI)(S,WD,AD,X)

icacls %windir%\serviceprofiles\networkservice\AppData\Lo cal\Temp /grant "CREATOR OWNER":(OI)(CI)(IO)(F)

This allows every user to create files and directories (WD = Write to Directory, AD = Add Directory, X = Execute, S = Synchronize). The user who creates them will be the “CREATOR OWNER” of the file/directory.

The “CREATOR OWNER” ACE allows this user to do whatever he wants with the file. Other users can’t access these files/directories because they are not “CREATOR OWNER” of them.



The other less favorable workaround is to disable the loadUserProfile setting on a per-appPool basis. loadUserProfile is a boolean property on an AppPool section, and can easily be set on the command line (for defaultAppPool) like this:



%windir%\system32\inetsrv\appcmd set config -section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false



hope this helps -



bill
May 16 '07 #5
jhardman
3,406 Expert 2GB
I'm glad you found an answer. Thank you for posting your solution.
May 18 '07 #6
Wow - I spent a whole weekend trying to narrow this problem down - I have been reading Excel into web pages since IIS3, and couldn't figure out why this broke so badly in IIS7 (Vista). Many, many thanks to msghaleb for posting this reply from "bills" - changing permissions on this temp file made everything work again! Great information - thanks!
Jan 2 '08 #7
I did try the solution on setting the permission on the TEMP files.. but I encounter problem. Not too sure if you can help.

After i execute :
icacls c:\windows\serviceprofiles\networkservice\AppData\ Local\Temp /grant Users:(CI)(S,WD,AD,X)

it tells me "access is denied". Successfully processed 0 files. Failed processing: 0 files.

Do you have any idea how to solve this? I have tried to search more info on icacls, but I can't find any.

THanks in advance.
Jul 14 '08 #8
jhardman
3,406 Expert 2GB
I did try the solution on setting the permission on the TEMP files.. but I encounter problem. Not too sure if you can help.

After i execute :
icacls c:\windows\serviceprofiles\networkservice\AppData\ Local\Temp /grant Users:(CI)(S,WD,AD,X)

it tells me "access is denied". Successfully processed 0 files. Failed processing: 0 files.

Do you have any idea how to solve this? I have tried to search more info on icacls, but I can't find any.

THanks in advance.
Give a little more detail, exactly how are you processing your file, and show some of the code that opens it.

Jared
Jul 14 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It...
6
by: Paul | last post by:
I was wondering if anyone has had an issue where using vba code to read an excel file and import the data into an access table some records are not imported from the excel file. It seems looking at...
1
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
1
by: Turner, GS \(Geoff\) | last post by:
> -----Original Message----- > From: siliconwafer > Posted At: 19 August 2005 15:20 > Posted To: c > Conversation: reading an excel file in C? > Subject: reading an excel file in C? > > >...
4
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
4
by: BerkshireGuy | last post by:
I need to import an Excel file. For reasons I won't get into, I cannot just link to the file or do an import specification, so I need to do it via code. I know of two ways of doing this - via a...
1
by: ndedhia1 | last post by:
I was reading in a log file like this that had no milliseconds: QuoteBlockTiming exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 601650761 block size QuoteBlockTiming...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.