Trying to load unmmanaged c++ dll in azure - c++

I'm trying to call to my unmanaged dll from my asp.net mvc web app.
when I call this dll from localhost it work just fine.
when publish the app to azure and try to call this dll I'm getting this:
Error:System.DllNotFoundException: Unable to load DLL 'SerenityConfigCodec.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).
I succeed to call to a simple dll in azure (not mine). According to Microsoft azure documentation.
I use a dependency walker on my dll to know the dlls that I need in azure and add them.
I have some theory that my dll need some extra dll in azure that dependency walker not tell me about them.
Or maybe I need to connect my website to iis and try to use iisreset to cause maybe the .bin folder in azure get into locked at run time and let iisreset unlock it.

Sounds like Azure cannot find your referenced DLL.
Is this DLL added as a Dependency in your project? or as a Nuget package?.
If it's a Dependency there two possible solutions depending on your publishing method:
Add the Copy Local to True if you are publishing using Web Deploy (Right-click > Publish from Visual Studio)
If you are publishing through Continuous Integration and a link to a repository (GitHub / Bitbucket / VSO / etc), add the DLL file to your repository (maybe in a folder especifically for that) and reference it in your project using that folder path.
If it's a Nuget package, it will fail if you are using Web Deploy (unless you set the Copy Local to True), if you are deploying through Continuous Integration, Kudu takes care of downloading all the packages on the deployment process.

I solved this problem by adding the compiled unmanaged DLL file to the managed project, so it would be included in the publish package. Since the added file was either the debug or release DLL I had to manually edit the .csproj file to conditionally copy either the debug or release build DLL depending on if I'm building the debug or release managed DLL. This in turn generates warnings every time I load the project but the builder handles it right. And I need to remember to rebuild the managed DLL to get it to pick up on changes to the unmanaged DLL since it hasn't been doing that for me automatically.
Depending on which version of VS you're using you may need to install the C++ runtime DLLs as well.
The 0x8007045A error indicates that the DLL was found but init failed, while the 0x8007007E error mentioned an a comment to another answer indicates that it couldn't find the DLL to load.

Related

VS2017 not showing Report Viewer in prerequisites

I am trying to deploy a wpf application with an embedded rdlc report using clickonce. The previous version of report viewer (in VS2015) was built-in so it was easy and convenient to use and I had no issues deploying this project.
Now since easy and convenient is not the goal anymore, in vs2017 after a failed deploy with an error message that gave me absolutely no help, I have come to realize that apparently you have to install 2 additional VS extensions and a report viewer runtime on every machine where an app uses and rdlc reports (feels like crystal reports all over again) and you have to exclude the automatically included Chinese localization files in your clickonce deployment (which cause a manifest parse error). Anyway, the instructions on MS website say that click once should have a "Microsoft Visual Studio Report Viewer" prerequisite option to select as requirement of installing your app. However, after installing the runtime on my development machine, restarting visual studio, this option is not available. Does anyone know how to get this to work?
I used Project|Manage NuGet Packages to add this package to my project.
https://www.nuget.org/packages/Microsoft.ReportViewer.Runtime.Common/12.0.2402.15
If you search with Manage NuGet Packages, there's quite a few ReportViewer related items. I'm not sure which ones are appropriate to your WPF app.
Anyway, the deployment project picked up the various ReportViewer assembly dependencies and everything seems to be working without the EXE redist from MS.

how i can find com.ibm.ws.exception.wsexception jar file?

i added the admin.jar file correctly to the classpath and to my java application, but these errors still appear 1- The project was not built since its build path is incomplete. Cannot find the class file for com.ibm.ws.exception.WsException. Fix the build path then try building this project.
2- The type com.ibm.ws.exception.WsException cannot be resolved. It is indirectly referenced from required, i understand that there is a helper jar file should be added to my app, but unfortunetely i could not find it.
Two things here:
1) You need WebSphere classes in your build path. The server provides an API/SPI jar specifically for this purpose: WAS_HOME/dev/was_public.jar. It contains WsException, among other classes.
2) You mentioned having "admin.jar" in your class path and Java application. If that means that you're packaging a WebSphere server jar in your Java EE application... don't do that. The server jars are not designed to be packaged within apps, and you run a very high risk of unexpected linkages and class loader hierarchy issues if you try it.
If this is a standalone Java client, not a Java EE application installed on the server, there are thin client jars in WAS_HOME/runtimes that are designed to be used in client application class paths; the server jars in the plugins directory are not designed to be used outside the context of the application server itself.
I agree with Jarid that the proper way is by using the client but if you still need it, then you can download it from https://github.com/NURGALIYESMUKHAMEDOV/Utils/blob/master/CaseSchedule/src/main/resources/wsexception.jar where I found it and used it in my library too.

Automated build installer using team foundation service

I have started using the preview of Microsoft Team Foundation Service (TFS in the cloud, henceforth TFService) for a small project, and I'm currently setting up builds using the online build service included with TFService.
What I want to do is to add an installer of some kind. I've previously worked with InstallShield Limited Edition, WIX and Inno Setup and would like to keep using one of those if possible.
I've previously integrated Inno Setup as part of a build process (TFS 2010). This involved installing Inno Setup on the build computer, and adding a custom build task for running an inno setup script. The last part should be possible with TFService as well, because it's possible to create custom build process templates.
However, I realize that installing anything such as Inno Setup or InstallShield will not work with TFService, since it's not possible to install any 3rd party software on the build computer (it's just a cloud service running on some unknown virtual computer which I cannot access).
So my question is; is there a way to automatically create an installer as part of a build process running on TFService? For example, is the build service capable of building installshield projects out of the box (there's a license included with Visual Studio after all)? Or are there other ways to do this?
I have some experience with this trying to get WiX and InstallShield to work with Microsoft TFS Preview cloud service using their managed build agents. On these agents, you don't have administrator rights and you can't install software.
This currently rules out InstallShield which must be installed.
It is however possible to check the WiX binaries into source control and pull them down as part of your build.
WiX uses .wixproj files (MSBuild) to define their project compile activities. This references a targets file and other properties ( referencing registry values ) that won't exist when you deploy this way. A small bit of hacking will get all of these properties to resolve to workable values.
The one problem you may still have though (and I'm thinking TFS managed build environment ) is that you may have to configure your projects to skip MSI ICE validation suites. On the build machines, I played on the windows installer service was outright disabled and this prevented the tests from running.

VC++ application doesn't run on other machines due to "incorrect configuration error"

I know that this topic has been posted over a dozen times, but I wasn't able to find a topic that fit my issue so I will post all detail below.
To start I will mention that I have two projects: The first is the main application and the second is a DLL. The project was due for a major revision and needed a DLL to be replaced due to the company I work in switching vendors. After creating the DLL needed to import into the project I was successfully able to test and run on my machine as well as other developers machines. However once I tried to deploy it on our barebones testing machine I got the error stating that the application configuration is incorrect.
Seeing as I've seen this error before I tried to install the vcredist but I got the same error message. I tried using dependecywalker to see if I had all my needed files for the application to run to which it stated that I was missing MSVCP80.DLL, MSVCR80.DLL, and MSVCR90.DLL. Seeing as running the vcredist didn't help I tried to create a msi installer. Once I deployed that I got the application to run, but at the same time it didn't. The application needs to load in configuration files to be able to run properly otherwise it is not able to connect to our database.
I was wondering if anyone had any advice on how I can include the needed policies/dependencies in order to get this project to be able to run successfully.
To sum it up:
Release application is able to run on other developer machines and
able to load all proper configuration files, but cannot be run on any
bare bone or test machines.
Application created from Visual Studio Installer is able to run, but
ignores the configuration file directory and tries to load in default
directories.
Project is built using VS2005 C++.
Any help would be greatly appreciated.
Thanks,
Sebastian
There are different versions of redist regarding the VS service pack. So make sure, that if you have installed the VS2005 with service pack 1 you provide the redist for VS2005 service pack 1.
You might have gotten the ATL security update on your build machine but not the target.

PowerBuilder 10.5 sample web services client application

I am trying to get the PowerBuilder 10.5.2 sample web services application running. I can open the workspace just fine, and I can see the objects and even run the app but I get a "bad runtime function reference" error when I try to invoke the service.
I believe I have installed all the requisite parts:
PB 10.5.2
.Net 2.0 SDK
Web searches reveal that some of the web services used by the sample app are defunct, but I can't imagine all of them are, so the error seems to indicate a problem with the setup or objects, not the third party services.
I can see pbwsclient105.pbd in the workspace list and in the Sybase shared objects directory. However, as a test, I tried to use the alternative method the documentation listed for setting up the PB proxy to the .Net web service objects (by importing PB extensions from pbwsclient105.pbx) and got a "invalid dll error" so perhaps my web service libraries are corrupted?
What else could be missing? Path settings? Incorrect .Net 2.0 SDK installation?
* * * Edit: Problem Solved - at least on my machine(s) * * *
I took a cue from the thread I found here and began examining what was happening with PowerBuilder when these errors occurred -- both during the import of the PBX and during runtime if you executed the sample application.
One person in the thread mentioned the issue was related to libeay32.dll and ssleay32.dll. This is not the first time OpenSSL has given me fits with these components -- my hard drive is littered with them in various application folders. These DLLs get loaded by PB when the PBWSCLIENT105.PBX extension is imported or by an app using the associated PBD at runtime. Sure enough, by using ProcMon, I was able to confirm that libeay32.dll and ssleay32.dll were being loaded from Windows\System32 as opposed to the version of the same DLLs located in the PB folder structure. Apparently, this is a problem. I renamed the two DLLs located in System32 to effectively remove them, fired up PB and the import of PBWSCLIENT105.PBX worked like a charm.
I have a similar issue with our PB 10.5 installation. Importing the PBX file gives me the error message:
---------- Import PB Extension:
Importing C:\Program Files\Sybase\Shared\PowerBuilder\pbwsclient105.pbx - Error: The file is not a valid dll or pbx file.
---------- Finished
I initially thought the issue was that the files were corrupt, etc. However, I installed PB 10.5 on a clean machine (a VM actually) along with the .Net 2.0 SDK and the import worked flawlessly; also, I was able to call a web service. Every developer in my group has the same problem on their own machines, but if they use a "clean" machine or VM with PB installed (and perhaps a few other apps), the import of the PBX file works without issue.
At this point I am trying to pin down what in the environment causes the problem, but haven't been able to yet. What's interesting, as you've noted, is that if you open the sample application, you can see the exact same imported libraries present; however, you get the error at runtime. All of this really points to something environmentally missing or incorrectly registered. So, if you have the ability to use a VM, I recommend that as a temporary work around.
One thing I'll add here: if you happen to use Vista or Windows 7 as your VM, the import of the library works fine, but I had issues generating the client-side proxy using the .Net web service engine. I finally discovered that in the background, the SDK tool WSDL.exe is being executed against the WSDL for the service in order to produce a .Net client-side proxy. Turns out that Vista/Win7 User Access Control was preventing WSDL.EXE from running. I ran PowerBuilder "as Administrator" and everything worked as expected in terms of generating the client-side proxy.
If you discover anything about why the PBX import doesn't work, I'd be interested in hearing about it!