ITextSharp saying File not found when published to My server

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 get 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?

ASP.NET MVC: First access after some minutes slow, then every following request is fast


How to get all input controls which are of type file in jquery
Your next step should be to confirm that what you think is happening is happening.

Razor view engine - exception when calling Any Function
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.

Write css for individual page in mvc3 project
Apply filters when monitoring of course, or else you'll end up seeing all the activity on the server.... WebForms app that runs MVC in a subfolder
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.

how do i have a facebook-like scrolling updates on my website showing all activity
Try replacing the font file temporarily with another standard one (e.g.

Razor view engine - How can I add Partial Views
arial or something) and see what happens.

MVC2 client/server validation of DateTime/Date using DataAnnotations
(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.

64 out of 100 based on 29 user ratings 54 reviews