HttpModule Native C++ dll in Azure - dll

I would like to run a native httpmodule (c++ 64-bit dll) in windows azure. Firstly is this possible and secondly, what id the best way to go about it?
I have previously used a native dll in azure but wrapped it within a managed c# httphandler which worked fine but this time I would like to host the native dll directly. Is it possible to just host the native dll in azure same as I would in IIS?

I believe you are using a Windows Azure Web Role and on Windows Azure Web Role, native HttpModule configuration with IIS will be the same as and other IIS server the only trick here is that you would be using Startup task to run AppCmd command to install, register and configure your native module.
The basic command you would need in your startup task will be similar to as below:
appcmd install module /name: string /image: string /add:true|false /lock:true|false
For example, to register, enable, and lock a module named ImageCopyrightModule with the .dll file in the %windir%\system32\inetsrv directory, type the following at the command prompt, and then press ENTER:
appcmd install module /name: ImageCopyrightModule /image:c:/%windir%/system32/inetsrv/ imageCopyrightModule .dll /add:true /lock:true

Yes It's possible, I recently had to use an unmanaged C library in my Azure project so what I did was to create a C++/CLI wrapper for it and simply reference it in my C# project.
I believe that's the easiest way to do it, otherwise you'll need to use P/Invoke to call the unmanaged native code directly from C#.
Remember that on the cloud side, Azure uses the 2008 Visual C++ runtime library so you'll either have to compile your C++ project using VS2008, or a better alternative would be to upload the Visual C++ 2010 Redistributable Package to the cloud and silently install it on start-up.
I list the 3 simple steps to do that here If you're interested.

Related

How to publish a web application project with third party DLL (zkemkeeper.dll) that causes an error?

I have .net core web application project which using a third party DLL (zkemkeeper.dll a C++ DLL). Adding this library to my VS project is fine.
I can add it as a reference and everything works fine when I tried to run it. However, VS didn't recognize the library of this DLL as you can see on the below image.
So due to this issue I can't publish the project? Any tricks on this?
Just do the following steps,
1. Register zkemkeeper.dll in server (where your side is hosted)
2. Also register above dll on the computer where you are developing it.
Note: best way to register dll of zkemkeeper
download sdk of 32/64 bit from http://www.zkteco.eu/index.php/downloads/software-downloads
run Auto-install_sdk file as a administrator or system.
it will automatically register required dll into your system
Thanks
Just sharing, I've already fixed the issue by using the DLL generated in my bin folder (Interop.zkemkeeper.dll). Now my only problem is this one.

How to use dll in classic asp

I asked a server if they could install aspJpeg so I can use it in my classic asp project but they told me that I should put its DLL in my own bin folder.
I have read some answers and guidelines using Visual Studio . But I didn't use visual studio in my project. There is no bin folder and no more extra files and settings to add and consume a dll in my project.
Can I consume a dll using manual code through web.config or inline with my asp codes (or vbscript code) or something like that? I have no access to command prompt and server administration and I want to do that through pure coding.
DLL must be registered on server side by using command
regsvr32 <youdll>
Your hosting company/hosting support team have to do this. You cannot do this remotely.
By the way, what IIS version are you using?
"There is no bin folder"
Yes, because it's not an ASP.NET project.
"but they told me that I should put its DLL in my own bin folder."
When you contacted hosting support team, did you mentioned that you are running Classic ASP website? You could upload DLL, but you cannot register it on their server.

error "429" AcitveX Component Can't create object (in vb6)

I have one problem in vb6. I created a .tlb file in VB.net 2005 by adding Com class to project. I built the project, I got .tlb file and .dll files while building project, i selected "Register for Com interop" from project properties and built. It registered autometically and I can use created .tlb file in that PC in Vb6 working fine. if I deploy application to another PC and run I am getting "Error 429 ActiveX Component Can't create object" run time error. What I need to do? Please help me as soon as possible. I can't deploy the application to client due to above error.
one possible solution is to install .net frame work on client pc i never want to install .net framework any other solution will be most appreciatable.
If you've created a DLL in a .NET language (such as VB.NET), the target computer must have the .NET Framework installed in order to use the DLL.
This a hard and fast requirement, irrelevant of how you're utilizing the DLL, whether from a VB 6 application through COM interop or otherwise. It is also a hurdle you'll have to jump over first, before you worry about things like registering COM components, as Uday's answer suggests.
If you don't want a dependency on .NET, you need to use another environment to create the ActiveX DLL; either C++ or VB 6 are possible choices.
One option may be that, while deployment, you need to register that .tlb file in System Registry using regsvr32 command in command-prompt. Generally static libraries does not work until they are registered with System Registry.
You might have seen many programs register components during installation like 'Registering Type Components' or 'Registering COM Components' (for those who do networking especially). Those components are nothing but native COM dlls and tlbs.
so when creating deployment project, add some scripting login to register thode dlls and tlb to System registry using:
regsvr32 <path to tlb/dll>
you have to recursivey call this command for every dll/tlb you want to register with system. For example, if you have 4 dlls and 2 tlbs then you have to call it 6 times providing the path of dll and tlb one at a time.

COM DLL registration failed with TFS 2010

I have a C++ DLL project which is created in VS 2010. It is exposed as COM(ATL). I used this dll to another .NET Project as reference. C++ Project linker settings are set as follows:
­"Register Output" = Yes
"Per-user Redirection = Yes
I created a build definition to build these two projects in tfs 2010. C++ Project builds fine, but .NET project fails because the output dll of C++ project is not registered. Setting to "Per-User redirection" = false does not work. I also tried using WF activity 'InvokeProecss' to register the c++ dll using Regsrv32/batch file/my own exe etc, but I get exit code of 5. My TFS 2010 is in Windows 2008 Server R2. And I think, it's not running the process as admin.
If I generate a interop dll using tlbimp, and then I refer that interop in my .NET proejct, it works fine(oviously in tfs build, I need to add InvokeProecss to call tlb). But this is not acceptable as our general practice is to refer a COM dll directly from .NET proejct.
Can anybody please help about this?
Is there a way to run the tfs automated build activity 'InvokeProcess' as Administrator without prompting for user name/password?
By default, the TFS Build Service runs as the "Network Service" account which is a relatively low-privilege account. Alternatively, you can configure it to run as any domain account you like. I wouldn't recommend that as a solution to the problem you described, however. I would agree with Hans that, in this case, it would be better to use the type library importer (TlbImp.exe) to "reference" your COM server from your managed assembly.
If the COM object isn't changing, you can just use the type library importer to generate an interop assembly, check that in and reference it from your .NET project. If it is changing, you can add a post-build step to generate the interop assembly rather than using the InvokeProcess activity. As Hans pointed out, you can't actually reference a COM object directly from a managed assembly. Your reference is actually causing an interop assembly to get generated at build time after resolving the reference to the registered COM server.

class not registered

I am installing an application on a client machine. The application is throwing an exception that I am logging that states "Class Not Registered". This an app written in Visual Studio 2005 using VB.NET. The dll dependencies of my .exe are located in the same folder as the .exe. What class is this talking about and how can I resolve this issue?
Does the application use any COM components? If so, make sure that they get registered properly on the client machine. You can either have the setup do this for you (if you have created a setup), or use the regsvr32 utility.
Based on the comments, I would say that you will need to install SQL Server on the client machine. I am no SQL Server expert, but I would guess it would be sufficient with the Client Components.
Try commenting out most/all of the code in the project (or create a hello,world setup) to isolate whether it's one of your 4 dependencies or something else entirely.