Adding a private Font works fine on my local dev machine with Windows 10 Pro. However on Windows Server 2012 R2 the very same code results in the following error:
System.Runtime.InteropServices.ExternalException: A generic error
occurred in GDI+. at
System.Drawing.Text.PrivateFontCollection.AddFontFile(String filename)
var privateFontCollection = new PrivateFontCollection();
privateFontCollection.AddFontFile("Roboto-Regular.ttf");
When I delete the file it results in a NotFoundException, so the file path has to be right. I ensured that every user has every possible permission on the file. (I found out that if I deny every permission on my local win 10 machine the same "generic error" occurs - so it might be a permission problem)
Has anybody a solution for this problem?
Could it be possible that the service user on the productive machine lacks some other rights that are necessary for "installing" private fonts? Maybe the font gets installed to a specific directory which is not allowed - but I could not find out where this would be.
Please help me with this very self explaining "generic error".
It seems to have been a problem with not using an absolute path. Didn't think of it at first, because deleting the file resulted in an explicit FileNotFound.
Using an absolute path did the trick.
Related
I have created a Windows Service using ASP.Net Core 3.x and C#. I started with the new Windows Service template when I built the project. When I run it from my development environment or from a console window it runs fine. When I install it as a Windows Service and attempt to start the service I get an
"Error 5: Access is denied." error.
I tried numerous things which I will outline below to eliminate the error but nothing seemed to work so I downloaded the sample app provided by Microsoft, at sample
Same result...when I run the sample app from within Visual Studio it runs fine, when running as a service I get the Access Denied error.
I am running all of this on my local machine, which I am an admin on.
I originally tried to run it using the default Local System account; got the Access Denied error.
I changed the Log On As to my domain account, the same one I use to log into my local machine which is an admin on this machine; got the same Access Denied error.
My account has the privilege set to run as a service.
The Event Viewer just shows the one message which says "Access Denied", no other messages are created.
I believe the Access Denied error is occurring before the C# code is even executed. What makes me believe this is that I added one line to the very top of the Program.Main.... File.WriteAllText("C:\\temp\\ws.log", $"Test of Worker Service # {DateTime.Now}. Content Root Path: {AppContext.BaseDirectory}");. My account has full access to the temp folder. This file gets created when I run the app from Visual Studio but it does not get created when I run the app as a service.
I have read numerous web sites, include this one and this one. No luck, everything I tried from these sites still produce the Access Denied error.
I have run out of ideas and am hoping someone here can provide me the answer. Thanks!
I found the solution and believe me I feel really stupid!!!
When I installed it as a service I only put the path in "binPath".
sc create WindowsService1 binPath="C:\temp".
Once I actually added the executable to the binPath parameter everything worked.
Changed it to sc create WindowsService1 binPath="C:\temp\WindowsService.exe" and it worked.
I know it is an Id10t error but Microsoft should really provide better messaging for the "sc" command. A message like "Cannot find file specified in the binPath parameter" would have been really helpful. Would have saved me about 6 hours of work.
Thanks everyone for reviewing and replying to this question.
This question is related to my previous question.
I need to publish a C# application (that has been set up in IIS 6.0 and built in VS2010) to a desktop with win7.
I have set up IIS on my desktop well. Now I can install the application on my laptop by accessing the URL
http://myDesktopName.domain.com/MyApp
pointing to a physical location in desktop
e:\myPath\myApp\myAppService.svc
When I publish a new version of the web service, the application should get updated when I open it.
But, it gave me an error:
**the filename,directory name, or volume label syntax is incorrect**
After searching online, I found this error is normally caused by some unacccepted chars in the link. Here is the code that the msi (MS installer) needs to access and get the new version of the application.
System.Diagnostics.Process.Start("msiexec", "/favmuso \"" + myurl + "\"");
here,
myurl is http://myDesktopName.domain.com/MyApp/MyAppSetup.msi
Here, http://myDesktopName/MyApp/ is the virtual directory set in IIS 6.0 on my desktop. I can access and download it from IE in my laptop without any problems.
But, when the application notified me that a new version is available for updating the old one, I clicked the pop-up ballon on the application icon and then I got the error:
Error 123. The filename, directory name, or volume label syntax is incorrect.
If I try to access it from the C# code, I got the same error.
Then, I did a test by running
msiexec **/favmuso** http://myDesktopName.domain.com/MyApp/MyAppSetup.msi /Lv mapp_msi.log
In the log file, i found :
MSI (s) (80:DC) [18:04:33:089]: SECREPAIR: Failed to open the
file:http://myDesktopName.domain.com/mypath/\myAppSdetup (10).msi for computing its hash. Error:123
Error 123. The filename, directory name, or volume label syntax is incorrect.
Why my applcation setup file name was changed to
\myAppSdetup (10).msi
The "/favmuso" options can be found at
https://technet.microsoft.com/en-gb/library/cc759262%28v=ws.10%29.aspx#BKMK_Install
Any help would be appreciated.
thanks
So I noticed that you've asked this question elsewhere, and everyone was focused on the /favmuso piece of it.
I've been recently exeriencing this issue when trying to repair MSIs with a URL source when the original application was installed by SCCM 2012.
The workaround I found was to add a registry value at HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer. The value below causes the MSI to skip the problematic portion of the repair and move on.
Name: SecureRepairPolicy
Type: REG_DWORD
Value: 1
To be a bit safer, you look into setting the registry value to 2 and using a whitelist as described in this Microsoft article: https://support.microsoft.com/en-us/kb/2918614. (Ctrl+F "Steps to opt-out the affected programs".)
I have a C# application that gets a list of directories inside a folder. This is done using the call
String[] projects = System.IO.Directory.GetDirectories("path/to/folder", "*", System.IO.SearchOption.TopDirectoryOnly);
This works fine on my machine, but after publishing (resulting in a setup.exe, as well as programName.application + Application Files) I tried running the program on a new machine and it threw an unhandled exception error.
The error was in regards to being unable to connect to a database, but the interesting part is that it was complaining about path not being valid, listing a path that only exists on my machine.
Does System.IO.Directory.GetDirectories not get reinitialized when running on another machine?
I guess the problem is with path/to/folder, as that path might not exist in new machine. Don't hard-code the path. Instead read it from config file (app.config using ConfigurationManager).
I'm getting the following exception when I try to install a ClickOnce application:
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\user\Downloads\appname.application resulted in exception. Following failure messages were detected:
+ Downloading file://192.168.2.9/appdir/appname.application did not succeed.
+ The network name cannot be found.
+ The network name cannot be found.
+ The network name cannot be found.
I haven't been able to figure it out. I've tried looking around on the net and there don't seem to be any resources on the issue. Does anybody know how to resolve this?
This turned out to be a problem with the installation URL in the publish settings. Rather than using a web path, I was using a share for the path. The actual location was set up in IIS, so of course the file could not be found at the share.
Changing the field "Installation Folder URL" from:
\\\server-name\path
to
http://server-name/path
resolved the problem. Silly mistake.
I fixed the issue in this way. Check the Permission in both IIS AND Folder
Give the IIS Full control Permision to Everyone
Share the physical path folder to Everyone
Mostly these kind of error messages are due to wrong connection string that cannot be found over network. Rechecking the Datasource value or server value and and database name in connection string will solve the problem
I was told that we had an old virtual machine that had the same problem and it was fixed by downloading and installing an "iis develepor toolset". Any idea what that "IIS developer toolset" might actually be?
IIS 7.0
This is on a windows 7 box trying to remote to a webserver and setup IIS.
DirectoryEntry rvd = forms_website.Children.Cast<DirectoryEntry>().First();
rvd.Properties["AFName"].Value = "Default Application";
0x80005006 (2174763162) is a generic IIS property error that is thrown for a LOT of reasons. The installation of a toolkit may easily have corrected a permission setting on an extension, updated a property in the metabase, etc. This would not be a directed fix so much as a lucky one as it is possible that the error being thrown was completely unrelated to the tool set, but the update corrected an ancillary issue.