I am using The .NET/Link for mathematica in my Asp.Net application (running under IIS 7.5) but am having issues where some of the custom fonts that Mathematica uses do not show up.
For example the character Pi doesn't show up. It should look like: but actually looks like: .
This problem only happens on one particular machine, and only when running it in IIS, if I create this image in a Console App (or even using IIS Express) then the image is created just fine.
For those with some experience with .NET/Link the code I am using to create the images is:
IKernelLink ml = MathLinkFactory.CreateKernelLink();
ml.WaitAndDiscardAnswer();
Image img = ml.EvaluateToTypeset("HoldForm[x Pi x]", 0);
context.Response.ContentType = "image/gif";
img.Save(context.Response.OutputStream, ImageFormat.Gif);
ml.Close();
But I don't believe an understanding of that is a requirement, as I believe its solely an issue with loading the font and using it in IIS.
So, I guess the meat of the question is: Is there any reason that IIS (or any Windows Service) wouldn't be able to read/process a font besides permission issues (since I tried running the service as Admin).
Related
I have developed an ASP.NET website that uses System.Windows.Media dlls to render a 3D Image as a bitmap.
The process is the client page requests a render.
The server then runs the Rendering code and sets the bitmap on the page.
This all works fine in VisualStudio, but as soon as I publish to IIS the rendered image no longer displays. The Bitmap rendered by Media3D is empty!
I am using RenderTargetBitmap to Render the ViewPort3d to a Bitmap.
I believe this is an IIS trust issue but I have been unable to solve it. Does anyone have a clue on how to work around this?
I am using .Net 4.5 and am running on Windows 7 64 bit, but the server that will be hosting it is Windows 8 Server, if that changes anything.
UPDATE
Process Monitor was very usefull.
From what I can tell
HKCU\Software\Classes\CLSID{AC757296-3522-4E11-9862-C17BE5A1767E}\Instance
HKCR\CLSID{AC757296-3522-4E11-9862-C17BE5A1767E}\Instance NAME NOT FOUND
HKCU\Software\Classes\CLSID{2B46E70F-CDA7-473E-89F6-DC9630A2390B}\Instance NAME NOT FOUND
HKCR\CLSID{2B46E70F-CDA7-473E-89F6-DC9630A2390B}\Instance NAME NOT FOUND
These keys could be causing the problem, but i'm not entirely sure what they are, googling the first one comes up with
http://msdn.microsoft.com/en-us/library/windows/desktop/ee719879%28v=vs.85%29.aspx
Which refers to Encoder-Specific Registry Entries. Which leads me to believe I am somehow missing the appropriate encoder/decoder for RenderTargetBitmap and BmpBitmapEncoder to work properly from w3wp.exe/ IIS. Where do I find these? I would of thought they came with .NET Framework. Any clues?
These are not requested when I run the website from Visual Studio...
Thanks,
GP
I have a line of code that I can run locally as part of a service that works perfectly fine.
sReportPath = objCrystalUtils.ExportReportToPDF("Report Name", iReportInfoID)
This code is run as a part of a service, and when I unit test it by feeding it data, it ultimately builds the report and prints it.
When I run the exact same piece of code inside an .ashx from an ajax call. The reports are generated (I can see the pdf files being created on disk) but the printing is not happening.
oRpt.PrintToPrinter(objReport.DefaultAutoPrint, True, 0, 0)
In both scenarios the same code is used to print the report. (objReport.DefaultAutoPrint = 0 in both cases)
My only thought is that the location of the code that is calling this method is in a different spot relative to the location of the bills themselves.
The printer that I'm trying to print to is a network printer intalled on my machine, and I'm running Windows 7 IIS 6.1
Any thoughts?
Edit:
Here is a thought... if I'm running one as a unit test locally and im running the other through a web app that is running via IIS, is there a difference in user id and user access to the default printer?
Edit:
So I added my local ASP, IUSR and SYSTEM users to the printer security and allowed them to print... no dice. So I checked the EVERYONE user and it is set to access and NO users are denied... so I think that kinda kills that line of reasoning.
Edit:
I changed the name of this post since I no longer think that the issue is ajax related since If I try to do the same process in code bebehind from a post back instead of running it from an ajax call i still get the same problem.
Patrick, for me it is a known issue of crystal reports, printing a certain report from a running application via IIS.
I got the same issue before, and upon our search for that issue, we got the following;
Report to be generated, exported, and then to be downloaded to client machine,
so user can print it locally (say, report will be exported as PDf file,
user can use print option of PDF reader).
It's not Crystal Reports or other third party app's problem. It's usually the IIS_IUSER's permission problem because it has no access to any network printers. A possible solution is in Process.Start doesn't work in IIS
I'm programming a very simple Qt-based application which will be interfacing some website. That website requires user to login with username/password and solved Captcha. Because of that Captcha, I decided to use QWebKit and just display the website for the user (and intercept cookies in my app). It works almost great. Almost, because I'm having a really strange problem.
On Linux my app worked like a charm. On 64bit Windows 7 (32 bit build with VS 2010) - it worked without problems too. But the same binary has a very strange issue under 32bit Windows 7. It works, but does not display Captcha images making logging in impossible. Of course, I used Dependency Walker and ensured that all the DLL's are accessible.
The Captcha is not a popular reCaptcha or something, but Minteye slider Captcha (BTW, in my humble opinion it is quite easy to solve by a computer). As you can see at the bottom of the page I linked to, this captcha downloads a series of images and user has to select the "correct" (ungarbled) one with a slider.
The problem is, that for no apparent reason, my app just doesn't show these images on 32bit Windows 7, while on 64bit version everything works. The code I'm using is very simple, but I'm posting it anyway:
loginView = new QWebView();
QWebPage *page = new QWebPage();
manager = new QNetworkAccessManager();
loginView->setPage(page);
page->setNetworkAccessManager(manager);
jar = new QNetworkCookieJar();
manager->setCookieJar(jar);
page->mainFrame()->load(QUrl("http://site.to.open"));
loginView->show();
I verified with Wireshark that these images are indeed being downloaded from the server. I even changed user agent string to hardcoded one to be sure that the server doesn't mess up something only for for 32bit windows 7. Unless I'm missing something, the dialogue with the server is identical and the problem is on client's side.
The only thing that differs (and I'm pretty sure is connected to my problem) is behaviour of WebKit when trying to navigate to specific URL via developer tools (one can enable them in QWebKit, so did I). When I open the Javascript console for login page and enter:
window.location = "http://www.google.com"
It works on all my platforms. But, when I enter the address of one of the Captcha images:
window.location = "http://img2.minteye.com/slider/image.ashx...
Results vary. On Linux and 64bit Windows 7 it works and I can see an image. On problematic 32bit Windows 7, WebKit shows error Frame load interrupted by policy change and that's all. I have no idea what that error means and what "policy" changed. Google search didn't help me - I found posts by people complaining that they see this error, but nobody explained what causes it (WebKit source isn't super helpful too). If somebody knows, I might be able to get a workaround for my problem.
I'm also very courious, why this problem is present only on 32bit version of Windows 7.
Seems like this is/was a bug in QtWebkit implementation, you can read more about it here:
https://bugs.webkit.org/show_bug.cgi?id=37597
Which version of Qt and QtWebkit are you using ?
It might be a good idea to try a newer version of Qt & QtWekbit.
If it helps in any case here is the code in Webkit which shows this error:
http://src.chromium.org/svn/branches/WebKit/472/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp
This is not a bug.
What happens is that this image was generated dynamically, probably Headers were misconfigured.
the Frame load interrupted by policy change occurs because the WebView tries to open something that is not "text/image" (is not supported).
You should use this ( https://stackoverflow.com/a/16782607/1518921 ):
//replace [QWebView] by your WebView
connect([QWebView]->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadContent(QNetworkReply*)));
...
void [main class]::downloadContent(QNetworkReply *reply){
//Replace "[main class]" by "Class" having the signs used in WebView.
[QWebView]->stop();
//solution: stop loading --replace [QWebView] by your WebView,
/*function to donwload*/
}
At this point if you have a download manager, it will ask to save the image instead of opening it, because the content is not supported.
Solutions:
What you can do is try to fix image headers.
if your server is not then there will be, then you will have to parse the header Content-type and see what type it is trying to send, having kind of content you will have to reimplement the QWebPage:
virtual bool extension(Extension extension, const ExtensionOption *option = 0,
ExtensionReturn *output = 0);
virtual bool supportsExtension(Extension extension) const;
Good luck.
Are there any particular settings one should optimally enable/disable/tweak when doing ASP.Net MVC development on local test machine Windows 7 using IIS 7.5 and moving in and out the debugger & recompiling refrequnetly (integration/troubleshooting stage now before TDD fantactics throw stones - although admittedly I could have more under test), I work with 64 bit edition but figure this probably applicable at both x86/x64?
I'll start with one:
Ping Period (seconds) - increase from 90 to 3000 (or something somewhat higher) so you can if unfortunately need to a good bit of time whilst debugging or disable ping on local test machine.
Credit: http://blogs.msdn.com/johan/archive/2007/09/12/my-web-application-times-out-when-debugging-in-iis7.aspx
However I see over stuff such as:
Disable Overlapped Recycle & Recycling settings etc.. that I wonder if could increase performance or make debugging less friction
Question prompted by the annoyance that I've ran across a few recent debugging issues (not apparent in production) including a random, and tempormental error "An assembly with the same simple name blah-blah-lah-assembly-definiton has already been imported . Try removing one of the references or sign them to enable side-by-side." (iisreset resovles) and generally slow debugging attaching. The points and answers to this question need not help with the above (I believe it may be related to spark view engine as that where the stacktrace ends) but figure it worth mentioning incase someone has a direct suggestion *
quick tip: if you're experiencing slow response times (~1-1.5 sec) from browsers other than internet explorer (eg: firefox, chrome, safari) while running your mvc/ other web app on your local machine using win7/vista, it is due to dns resolution with ipv6.
firefox solution: disable ipv6 in about:config (boolean cfg 'network.dns.disableIPv6')
machine wide soft solution: uncomment the good old localhost address in the hosts file (%WINDIR%\System32\drivers\etc\hosts):
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
machine wide hard solution: disable ipv6 completely
credit goes to this blogpost: http://weblogs.asp.net/dwahlin/archive/2007/06/17/fixing-firefox-slowness-with-localhost-on-vista.aspx
Embarcadero guys just published a fresh article on similar topic for Delphi Prism (aka Delphi for .NET), so why not take a look on their suggestions?
http://edn.embarcadero.com/article/40108
From the experience i have working with asp.net mvc, i can tell that there are no special settings for IIS 7 or IIS 7.5 for working on asp.net mvc projects. It works fine in the default form, you just need to create a new website and point it to the folder that has the files for you application.
For debugger if you ask, you can simply put a breakpoint in the code and hit that breakpoint when you run the application from visual studio. But by default the application will use the development web server that fires up when you run a web application from visual studio. If you want to the application to run using the IIS installed on your system you will have to change the project settings. See here for a screen shot of how to do so
http://blogs.bootcampedu.com/blog/post/Debugging-aspnet-mvc-application-using-IIS.aspx
Additionally you can also use System.Diagnostics.Debugger.Break(); for putting a break point in the code.
If you only want to debug your application, I recommend to use the built-in development server of Visual Studio.
If you debugged the most of it or want to do that on IIS, I recommend you the Ctrl+Alt+P shortcut, which enables you to attach a debugger. Select w3wp.exe and you can debug with IIS.
Trying to print an ASP.NET Charting control behind the scenes in my web app. I think it is a permissions issue with the printer as everything is ok up until the point where my code calls:
chart.Printing.Print(false);
bool finished = false;
while (!finished)
{
finished = File.Exists(settings.GetValue("statusfile")); // file which indicates document was printed
System.Threading.Thread.Sleep(1000);
}
At this point the page just freezes (or continues to load endlessly - infinite loop!) Understandably this is happening because I am 100% relying on the document being printed. I do intend to add a timeout, however, at the moment I am just trying to figure out why exactly the document is never being set to the printer!
I have given the account (which the AppPool is running under) permissions to all the relevant folders and even the pdf printer itself...Still nothing.
Am I missing something? Is there any issues with printing on the server side via ASP.NET? I have encountered some issues doing this via WindowsServices in the past not sure if it is a similar problem with ASP.NET websites.
Update
As suggested I updated the AppPool to give myself (admin) permissions and it is the same issue. So by the looks of things the job is never being sent to the printer. I can't seem to figure out why though...
Probably should have mentioned this in my original post....but I am invoking the printer through a referenced DLL, this code is not being called directly from my application (incase it matters). Also this runs fine on my Development machine which is running Windows 7 IIS7.0 where as the server is running Windows 2003 server with IIS6.0.
Update 2
I removed the while loop and just left in the chart.Printing.Print(false) line and turns out the document IS being sent to the printer. So the issue must be with the settings file not getting written which is why the loop never breaks out!
To isolate if this is indeed a permissions issue, you could try running the application using the Visual Studio web development server, which will run under your credentials. Or if that's not an option, temporarily change the IIS app pool so it uses your credentials. If things still do not work, you may have another issue. I'm not sure which charting library you're using (is it the newish Microsoft one?), but maybe Print wants to show a printer dialog.