Mahendra971
Mahendra971

Reputation: 13

azure webapp with c++ dll not working

I've created a Azure Web in C# which references to a native C++ Dynamic library. On the local host application is running well.

But when I've deployed the web app to Cloud Azure, its not working. Not getting clue how to go forward. please help.

On the reset API call getting following "An error has occurred."

Upvotes: 0

Views: 1406

Answers (1)

Amor
Amor

Reputation: 8491

On the reset API call getting following "An error has occurred."

To get the detail error information from ASP.NET REST API, we need to set the value of IncludeErrorDetailPolicy property as 'Always' in WebApiConfig.cs.

config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

If the exception you got after changed the IncludeErrorDetailPolicy is DllNotFoundException, please make sure the native DLL is deployed successfully to Azure Web App bin folder. By default, the native DLL file will not be deployed with your VS publish. You need to upload this file to the bin folder of your web app using FTP or Kudu site.

If the exception you got after changed the IncludeErrorDetailPolicy is BadImageFormatException, you need to check the platform of your Web App and your native DLL.

enter image description here

If the platform of your Web App is 32 bit, please make sure the native DLL was build target Win32 or All Platforms. If you build the DLL on a 64 bit machine. All Platforms is required.

enter image description here

In addition, Azure Web App run in a secure environment called a sandbox. The sandbox generally aims to restrict access to shared components of Windows. For detail information, link below is for your reference.

General Azure Web App Sandbox Restrictions

If your native DLL use one of the restricted APIs. Calling to your native DLL also will be failed. To see all the dependent modules of your native DLL, you could download and use Dependency Walker.

Upvotes: 1

Related Questions