I've found this says azure web/worker role can load native c++ dll. Does azure website also support this?
My site is a mvc site that p/invoke a native c++ dll which read files from local drive and does some calculations. the reason i'd prefer azure website is because it starts from free.
Thanks.
Azure websites can also load native dlls. I just made it work.
Here are the steps (referred from here):
Compile your solution.
Right click on the managed project and select "Add/Existing Item". Do not use "Add Reference".
Navigate to your compiled native DLL and select it (adjust file types as needed).
Click on the down arrow in the "Add" split button and select "Add As Link".
Right click on that freshly added file and select "Properties".
Make sure "Build Action" is "Content" and "Copy To Output Directory" is set to "Copy always" or "Copy if newer".
Note: in step 2, you should right click on the project, so that the dll will be copied to the bin folder, and uploaded to Azure server. If you put it in some folder instead of under the project directly, the dll will be copied to /bin/somefolder, which is still invisible.
Hope this helps.
You can load a native DLL, but there are some requirements. First, it must be targeting x64, not x86.
Also, you must build it against the proper toolset:
By default, only the Visual C++ runtime libraries for Visual C++ 2008 are installed on Windows Azure worker and web roles. Therefore, native code compiled against the Visual C++ runtime library for Visual C++ 2010 or Visual C++ 2005 will fail to load in worker and web role instances. If you have both Visual Studio 2008 and Visual Studio 2010 installed on the same computer you can use the native multi-targeting feature of Visual Studio 2010 to build native libraries for your application with the Visual Studio 2008 platform toolset (compiler, linker, headers, and libraries). For more information about using Visual Studio 2010 to build an application with the Visual Studio 2008 platform toolset see C++ Native Multi-Targeting (http://go.microsoft.com/fwlink/p/?LinkId=231170).
Alternatively, you can setup a startup task that runs elevated which copies the requirements for your native DLL onto the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With