Is it possible to install c++ compiler in azure app service - c#

I have azure app service on Windows and I want to install c++ compiler on it.
I need the c++ compiler to compile and run c++ code runtime. The user submit some code(console application) I compile it and then run it with different inputs. I run command like g++ file.cpp for compilation and file.exe in cmd using Process class in c#.
Is there a way to connect remotely to my azure app service and install the c++ compiler? Or are there some other ways to install c++ compiler on azure app service?

No, you cannot install software (like your compiler) in an Azure App Service. https://stackoverflow.com/a/36185208/1537195
You would need to go to something like either your own container (see for example Azure Web App for Containers or Azure Container Instances) or host your custom code inside a VM.

Related

Running .exe from asp.net web API for consurrent request in azure environment

I am new to Azure and its functionality.
Currently we are trying to implement below -
Consume C++ DLL in Web API like below -
Create ASP.NET WEB API
Add C# DLL as reference to it
Run Console application (.exe) from C# DLL using process.
[Console app is required since direct call to C++ dll from C# is not working in case of concurrency due to some stack issues in c++ dll]
This console app is calling - C++ DLL using DllImport.
With above set up it is working fine on virtual machine/ window machine environment.
Now we want deploy this as Azure API app.
With above architecture - (Asp.Net MVC Web API -> C# Web DLL -> C# console app (.exe) -> C++ DLL),
Functionality is working fine on azure api app even with concurrent request.
In this case, we are keeping console.exe at same location as C# DLL on azure [C:\home\site\wwwroot\bin]
I want to know if it is fine to run console app (.exe) in azure app service, considering multiple concurrent request will launch separate console application.

Setting external dependencies in a .Net Core (c#) app

My application will need to use an external command line app at some point. I will then create a process and then call the external executable. The command line tool is available for Unix and Windows systems and I was wondering what is the best way to set the dependencies in my .NET Core app.
Of course, I could write code to download the executable for the current OS where the app is running on in Base directory and then reference it in the app but it seems pretty wasteful as if the user has already install the commandline via yum or apt-get then it doesn't make sense to re-download the binaries.
There can be two ways to solve this problem.
Check in the installer:
I would suggest to add check in installer of your .NET Core app, to see if the dependency is present by looking at windows registry (or any similar table depending on OS where you are installing your application).
You can stop installation and ask user to install the dependency first.
The other option is to download the utility as a part of your installation process and install it.
Check in the app:
If you do not want to do this during installation, you can also do this either during app startup or during the startup of your module which needs this external dependency. You can detect and if it is not available, can show a nice information message to user to download and install it.
The decision will totally depend on the design of your application.

mono-service for mkbundle'd apps

I have a Windows service that I want to run with Mono on Linux. I can run it as a service using mono-service, and this works fine.
I also want to mkbundle the application to ease deployment for end-users, so they don't need to mess around installing Mono themselves.
What is the recommended way to run the resulting native binaries as a service on Linux, while still handling the OnStart and OnStop events?
mkbundle produces native code, so you can run the way you used to run the executable on the original platform.
It will only be an executable you might have to add it as service on linux yourself after creating an init.d script.
had to add it as an answer, as i can't add comments

What is the preferred way to register a .tlb on a build machine?

I have a .net solution with a C# project and a C++ project. The C++ project is an automation server (.exe). The C# project references an ActiveX interface produced by the C++ project (.tlb or registered interface on the machine). This works great on a development machine as I am registering the .tlb using regtlibv12.exe in a post build event in the C++ project. On the build machine, this fails because the service that runs the builds does not have rights to update the registry.
Is it typical to have the service that runs automated builds run as an administrator? Is there another preferred way to do this?
I also read that regtlibv12.exe is not always installed. Is there another way that is preferred to register a .tlb?
In a C# project just check if C++ application (automation server) is running and run it if not.
Then automation server (.exe) will register all available CLSID's in a system
I found no other way to register the type library in the build process other than using regtlibv12.exe. I had to make sure the automated build service is an administrator and everything works.

How to run c# app having dll files on linux

My c# apps developed on windows run nicely on ubuntu, but the ones having dll files don't. Is there a work around or i have to recompile the code on linux
Interop.SpeechLib.dll is part of Microsoft's Speech API (SAPI).
That doesn't exist on Linux, so you'll have to find an alternative API to call there.
You won't necessarily have to maintain two separate code bases, though. You could execute a run-time check for the host platform/environment, and call the appropriate API for that environment.

Categories

Resources