I wrote a .Net ConspleApp using the NAudio library. If I port the code to a Docker container and run it on Linux, I get the following error message when calling the library in the code.
XML-Encoder System.DllNotFoundException: Unable to load shared library 'Msacm32.dll'
or one of its dependencies. In order to help diagnose loading problems, consider
setting the LD_DEBUG environment variable: libMsacm32.dll: cannot open shared object
file: No such file or directory
at NAudio.Wave.Compression.AcmInterop.acmFormatSuggest2(IntPtr hAcmDriver, IntPtr
sourceFormatPointer, IntPtr destFormatPointer, Int32 sizeDestFormat,
AcmFormatSuggestFlags suggestFlags)
at NAudio.Wave.Compression.AcmStream.SuggestPcmFormat(WaveFormat compressedFormat)
at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)
at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)
at NAudio.Wave.Mp3FileReaderBase..ctor(Stream inputStream, FrameDecompressorBuilder
frameDecompressorBuilder, Boolean ownInputStream)
at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)
at XML_Creator.CreateXml.makeXml(String inputFile, String outputFolder) in
/App/CreateXml.cs:line 94
I copy the msacm32.dll in the Dockerfile into the program directory but unfortunately it doesn't work! What am I doing wrong?
COPY msacm32.dll /App/msacm32.dll
thx
I am building an application that scaffolds a SSIS package using EzAPI (Version 0.8.5). The code runs perfect within visual studio, no errors or bugs until I publish the MVC application (.NET 4.5) to the IIS server (Version 10.0.14298). This is when the function fails and doesn't save the package. The following error is thrown on save:
{"The system cannot find the file specified. (Exception from HRESULT:
0x80070002)":null} source: Microsoft.SqlServer.ManagedDTS
I have ensured that SSIS, Integration services have been installed on the IIS server, exact same version as my local instance MSSQL2017 so the DLL's I require are all in the same folders. I deployed to my local instance of IIS and get the same error as well.
using Microsoft.SqlServer.SSIS.EzAPI;
EzPackage _package = new EzPackage() { Name = "Package" };
_package.SaveToFile(#"C:\Package.dtsx"); // Fails here with error
The expectation would be that the package would be generated and then I would be able to view it within the C drive but it looks like it fails when it tries to build / finalize the package
Stack Trace:
" at Microsoft.SqlServer.Dts.Runtime.Package.SaveToXML(String&
packageXml, IDTSEvents events)\r\n at
Microsoft.SqlServer.SSIS.EzAPI.EzPackage.SaveToXML(IDTSEvents
events)\r\n at
Microsoft.SqlServer.SSIS.EzAPI.EzPackage.SaveToFile(String
fileName)\r\n at method(ViewModel model) in Logic.cs:line 641"
Try creating a folder in C:. For example, C:\packages. Make sure the app pool user has read/write access to the folder. Try adding IUSR or the app pool ( IIS AppPool\ApplicationPoolName ) user to the C:\packages folder with read write permissions.
I created a solution in VS 2017 with 2 main projects (& common ones). The architecture illustrates a very large legacy project, therefore cannot be changed.
The main project is a .Net executable which it's main class inherits from 'ServiceBase' class in order to be used as a Windows service. It defines WCF endpoint and uses an interface 'IWcfXmlServer' to process a request.
The other project is a C++ project with a class that implements 'IWcfXmlServer' interface and used to process a request.
I have created a Windows service locally and pointed it to the .exe file of the solution and it worked fine.
The next step is to put that app on a Docker container.
I added Docker support, which added "docker-compose" .yml file:
version: '3.4'
services:
wcfservice:
image: ${DOCKER_REGISTRY}wcfservice
build:
context: .\..\WcfService
dockerfile: Dockerfile
and a Dockerfile:
FROM microsoft/dotnet-framework:4.7.1-windowsservercore-1709
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["C:\\app\\WcfService.exe"]
When I build the solution and start debugging I get:
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
but still, the container is created.
I opened PowerShell in the created Docker container and used "New-Service" to create a new service and point it to my .exe file. When I try to run Start-Service I get an error.
I used the Windows event log to get the error description:
EntryType : Error
Message : Service cannot be started. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or
assembly 'testole.dll' or one of its dependencies. The specified module could not be found.
at WcfService.WcfXmlServerFacade..ctor()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.ServiceModel.Description.ServiceDescription.CreateImplementation(Type serviceType)
at System.ServiceModel.Description.ServiceDescription.SetupSingleton(ServiceDescription serviceDescription, Object implementation, Boolean isWellKnown)
at System.ServiceModel.Description.ServiceDescription.GetService(Type serviceType)
at System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implem...
Source : WcfService1
'testole.dll' is my c++ project compiled.
** I already checked that 'testole.dll' is present in the same directory of the .exe file inside the container.
I can't figure out neither why it fails to run the C++ dll, nor how to get more information about the error (Console.Writeine() \ Debug.Writeine()) didn't work for some reason.
Thanks in advance.
Most probably you're missing Visual C++ Redistributable package. I suspect it's not installed by default on windows docker images.
Try adding following lines (for downloading VC++ 2015 Update 3 x64) to your Dockerfile just below FROM line:
ADD https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe /vc_redist.x64.exe
RUN C:\vc_redist.x64.exe /quiet /install
Source (https://github.com/Microsoft/dotnet-framework-docker/issues/15)
In my Xamarin Android app I am storing screen shots in the following path System.Environment.SpecialFolder.MyDocuments. When I am running the app on windows simulator, where exactly this file get stored ? I searched almost my entire systen but no luck. I refered to many links on internet no luck again. where exactly I can see this data on windows 10 system. The file path I am setting it as using following code is
string filepath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)+"/Screen1.png";
while debugging I can see the value of filepath as "/data/user/0/ArcGISAndroid.ArcGISAndroid/files/Screen1.png"
When I am tryiing with A local directory in app I am getting follow error :{Java.IO.FileNotFoundException: C:\T\sampless.png: open failed: EROFS (Read-only file system) ---> Android.Systems.ErrnoException: open failed: EROFS (Read-only file system)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at Java.Interop.JniEnvironment.
Is their a way in Xamarin.Android to store the files in local to cross check them ?
You can push and pull files to a virtual sd folder from the SD card tab of the advanced tools options.
See: https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/debug-on-emulator/visual-studio-android-emulator/
The file is not stored on the Windows but on the virtual machine that runs on it. You can't get it from Windows.
I've been using TuesPechkin for some time now and today I went to update the nuget package to the new version 2.0.0+ and noticed that Factory.Create() no longer resolved, so I went to read on the GitHub the changes made and noticed it now expects the path to the dll?
IConverter converter =
new ThreadSafeConverter(
new PdfToolset(
new StaticDeployment(DLL_FOLDER_PATH)));
For the past few hours I've tried almost all the paths I can think of, "\bin", "\app_data", "\app_start", etc and I can't seem to find or figure out what it wants for the path and what dll?
I can see the TuesPechkin dll in my bin folder and it was the first path I tried, but I got the following error:
Additional information: Unable to load DLL 'wkhtmltox.dll': The
specified module could not be found. (Exception from HRESULT:
0x8007007E)
Where is that dll and now can I get it as the library doesn't seem to contain it, I tried installing the TuesPechkin.Wkhtmltox.Win32 package but the dll still is nowhere to be found. Also I am using this in a asp.net website project so I assume that using the following should work for obtaining the path, right?
var path = HttpContext.Current.Server.MapPath(#"~\bin\TuesPechkin.dll");
Further information: https://github.com/tuespetre/TuesPechkin/issues/57
The Tuespechkin has a zip file as a resource in the Win32 and Win64 embedded packages for the 'wkhtmltox.dll' file.
What it does when you use the Win32 or Win64 Embedded package is unzips the file and places it in the directory that you specify.
I have been putting a copy of the wkhtmltox dll at the root portion of my web app directory and pointing the DLL_FOLDER_PATH to it using the server physical path of my web app to get to it.
According to the author, you must set the converter in a static field for best results.
I do that, but set the converter to null when I am finished using it, and that seems to work.
Tuespechkin is wrapper for the wmkhtmlox dll file.
The original file is written in C++ and so will not automatically be usable in C# or VB.NET or any of the other managed code domains.
The Tuespechkin.dll file DOES NOT contain a copy of 'wkhtmltox.dll'. You either have to use one of the other embedded deployment modules or install a copy of the 'wkhtmltox.dll' in your web app after downloading it from the internet. That is what I do, and it seems to work just fine.
I am using Team Foundation Server, and attempts to compile code after using the Tuespechkin routines will fail the first time because the 'wkhtmltox.dll' file gets locked, but all you have to do is simply retry your build and it will go through.
I had issues with the 32-bit routine not working in a 64-bit environment and the 64-bit environment not being testable on localhost. I went with the workaround I came up with after examining the source code for Tuespechkin and the Win32 and Win64 embedded deployment packages.
It works well as long as you specify a url for the input rather than raw html.
The older package didn't render css very well.
If you are using a print.aspx routine, you can create the url for it as an offset from your main url.
I don't have the source code I am using with me at this point to offset to your base url for your web application, but it is simply an offshoot of HttpRequest.
You have to use the physical path to find the .dll, but you can use a web path for the print routine.
I hope this answers your question a bit.
If you are getting this error -> Could not load file or assembly 'TuesPechkin.Wkhtmltox.Win64' or one of its dependencies. An attempt was made to load a program with an incorrect format.
In Visual Studio Go to -
Tools -> Options -> Projects and Solutions -> Web Projects -> Use the 64 bit version of IIS Express for web sites and projects.
I installed TuesPechkin.Wkhtmltox.Win64 Nuget package and used the following code in a singleton:
public class PechkinPDFConvertor : IPDFConvertor
{
IConverter converter =
new ThreadSafeConverter(
new RemotingToolset<PdfToolset>(
new Win64EmbeddedDeployment(
new TempFolderDeployment())));
public byte[] Convert(string html)
{
// return PechkinSync.Convert(new GlobalConfig(), html);
return converter.Convert(new HtmlToPdfDocument(html));
}
}
The web application then has to be run in x64 otherwise you will get an error about trying to load an x64 assembly in an x86 environment. Presumably you have to choose x64 or x86 at design time and use the corresponding nuget package, it would be nicer to choose this in the web.config.
EDIT: The above code failed on one server with the exact same message as yours - it was due to having not installed VC++ 2013. So the new code is running x86 as follows
try
{
string path = Path.Combine(Path.GetTempPath(), "MyApp_PDF_32");
Converter = new ThreadSafeConverter(
new RemotingToolset<PdfToolset>(
new Win32EmbeddedDeployment(
new StaticDeployment(path))));
}
catch (Exception e)
{
if (e.Message.StartsWith("Unable to load DLL 'wkhtmltox.dll'"))
{
throw new InvalidOperationException(
"Ensure the prerequisite C++ 2013 Redistributable is installed", e);
}
else
throw;
}
If you do not want run the installer for wkhtmltox just to get the dll, you can do the following:
As #Timothy suggests, if you use the embedded version of wkhtmltox.dll from TuesPechkin, it will unzip it and place it in a temp directory. I copied this dll and referenced it with the StaticDeployment option without any issues.
To find the exact location, I just used Process Monitor (procmon.exe). For me it was C:\Windows\Temp\-169958574\8\0.12.2.1\wkhtmltox.dll
In my case, I am deploying on a 64-bit VPS then I got this error. I have solved the problem by installing the wkhtmltopdf that I downloaded from http://wkhtmltopdf.org/downloads.html. I chose the 32-bit installer.
In my case, I have solved the problem by installing the Wkhtmltox for win32 at https://www.nuget.org/packages/TuesPechkin.Wkhtmltox.Win32/
This error: Unable to load DLL 'wkhtmltox.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) is returned in two situations:
1- Deploy dependency not installed:
For solve this, you can install nuget package "TuesPechkin.Wkhtmltox.Win64" and use this code (for WebApplications running in IIS):
IConverter converter =
new ThreadSafeConverter(
new RemotingToolset<PdfToolset>(
new Win64EmbeddedDeployment(
new TempFolderDeployment())));
// Keep the converter somewhere static, or as a singleton instance!
// Do NOT run the above code more than once in the application lifecycle!
byte[] result = converter.Convert(document);
In runtime this code will copy the dependency "wkhtmltox.dll" in a temporary directory like: "C:\Windows\Temp\1402166677\8\0.12.2.1". It's possible to get the destination of file using:
var deployment = new Win64EmbeddedDeployment(new TempFolderDeployment());
Console.WriteLine(deployment.Path);
2- Microsoft Visual C++ 2013 Redistributable not installed:
As described here:
https://github.com/tuespetre/TuesPechkin/issues/65#issuecomment-71266114, the Visual C++ 2013 Runtime is required.
The solution from README is:
You must have Visual C++ 2013 runtime installed to use these packages. Otherwise, you will need to download the MingW build of wkhtmltopdf and its dependencies from their website and use that with the library. https://github.com/tuespetre/TuesPechkin#wkhtmltoxdll
or, you can install the Microsoft Visual C++ 2013 Redistributable:
choco install msvisualcplusplus2013-redist
Here is AnyCpu version, also support iis-base or winform application
using TuesPechkin.Wkhtmltox.AnyCPU;
...
var converter = PDFHelper.Factory.GetConverter();
var result = converter.Convert(This.Document);
Reference : https://github.com/tloy1966/TuesPechkin
Installing the Visual C++ Redistributable for Visual Studio 2013 resolved the error for me.
https://www.microsoft.com/en-us/download/details.aspx?id=40784