asp.net - Excel is not able to access from C# -
this regarding excel issue facing in production. have asp.net application reading excel shared drive. having issues dcom configuration , security settings on our server preventing complete process.
we running process service account defined in dcom identity tab.
we have full permission shared drive service account application reading file. still getting error below. (error message : microsoft cannot access file: there several possible reasons: file name or path not exist, file being used program, workbook trying save has same name open workbook )
we have full permission service account on excel location . application run different users cannot change dcom setting ‘interactive user’. business wants application run using on service account. if change ‘interactive user’ working expected , excel opening without issue.
service account added com property settings.
i created desktop folder under windows\system32\config\systemprofile\desktop , windows\syswow64\config\systemprofile\desktop , gave full permissions service account, issue did not resolve issue.
could please us.
string con = @"provider=microsoft.jet.oledb.4.0;data source=d:\temp\test.xls;" + @"extended properties='excel 8.0;hdr=yes;'"; using(oledbconnection connection = new oledbconnection(con)) { connection.open(); oledbcommand command = new oledbcommand("select * [sheet1$]", connection); using(oledbdatareader dr = command.executereader()) { while(dr.read()) { var row1col0 = dr[0]; console.writeline(row1col0); } } }
try . guess work fine
Comments
Post a Comment