开发者

ITextSharp saying File not found when published to My server

I am using ItextSharp and I am getting a new font for it by doing this

string  fontPath = Path.GetFullPath("C:\\BMSApplicationFiles\\Fonts\\FREE3OF9.TTF");
BaseFont barCodeBase = BaseFont.CreateFont(fontPath, BaseFont.CP1252, BaseFont.EMBEDDED);

That file is in that directory on both my dev machine and the server. When i run this on my dev machine it works fine, when published to my server I 开发者_如何学Goget an error saying FREE3OF9.TTF is not found as a file or a resource. I have double and triple checked that the file is in fact there on my server. My application has full trust on IIS. and IIS user has full access to this folder. And still I get this error. Very frustrating. Any ideas??

This code is Not inside the Web Application but inside a DLL class library that the web application is referencing. Do I need to add any more special permissions or something?


Your next step should be to confirm that what you think is happening is happening. If you are allowed to, download and install Process Monitor which will allow you to log activity including which files are being attempted to be accessed and by which user account. Apply filters when monitoring of course, or else you'll end up seeing all the activity on the server...

If that only confirms that the correct file is being attempted to be read by expected user then maybe there's something up with the font. Try replacing the font file temporarily with another standard one (e.g. arial or something) and see what happens. (this is unlikely to help as it works on your dev machine, but might be worth a go)


Most probably you have a security issue.

If you run IIS7 then check that IIS_IUSRS group has an access to the file (open file properties in explorer select Security tab etc).

If you run IIS6 then check that IUSR_MachineName account has an access to the file.


I had a similar error when I tried to get it working with IIS. Within IIS, I had to add he file directory as a virtual drive. That worked for me when I had a similar situation set up. Hopefully it works for you, best of luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜