Running dotnetcore Console application in Service Fabric Guest Executable - .net-core

I am trying to run a dotnetcore Console application in a ServiceFabric GuestExecutable Container. While I was adding this GuestExecutable service to my SF application, I cofigured as follows
Code Package Folder -> ..repos\NewDllGuestSF\CoreConsole\bin\Debug\netcoreapp2.0
Program -> CoreConsole.dll
Working Folder -> CodePackage
Here, I know I am trying to host this .dll file as my executable for the GuestExecutable service. This is what I am trying to do but could not somehow. When I tried the same with the treditional .NetFramework app and with an .exe executable, I am able to run it successfully on SF cluster. But I need to do is with dotnetcore application and of course with a dll executable.
So far I have tried is -
I can generate a dll as well as an exe while building my dotnetcore console application and use the generated .exe file in GuestExecutable. But here, I have to configure my console app to target multiple Frameworks as "netcoreapp2.0;net461", that is something I can not do for some reasons.
When I run my dotnetcore Console app with a dll executable in SF cluster, I faced the following error
Here if we see, the GuestExecutable service remains in healthy state but the application doesn't.
Can anyone please help me out on this, all I want to do is to host a .dll file as entry point in a GuestExecutable SF service.

As far as I understand you need to configure CodePackage in ServiceManifest.xml to run your .dll using external executable.
Here is the example how this could be done (please pay attention to IsExternalExecutable="true" attribute):
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost IsExternalExecutable="true">
<!-- We are using dotnet cli to launch our Service.dll -->
<Program>dotnet</Program>
<Arguments>Service.dll</Arguments>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
Hope it helps.

Related

Where to find coredump on Azure App Service using Linux?

I am using Azure App Service hosted on linux to use a .Net Core 6.0 app.
I have a null pointer error that is resulting in a segfault, that in turn is taking down the app service. I have had a few errors that result in segfaults so while I can fix the null pointer I really want to find why the container is crashing.
I can see the the following in AppServiceConsoleLogs:
/opt/startup/startup.sh: line 17: 65 Segmentation fault (core dumped) dotnet xxx.dll
I am hoping if I can find the dumped core I might figure out the segmentation fault.
I have looked around the folders by going into the SSH console, but I cannot find anything that looks like memory dump.
Where to find coredump on Azure App Service using Linux?
I have deployed the .NET Core 6 App to Azure App service.
Navigate to Azure portal => your Deployed App Service => Advanced Tools => Go .
Click on - Site wwwroot.
Deployed files will be compiled into dll files.
Click on the file, you can see the content.
We can also check the files in Bash.
In Bash, Navigate to the Application root directory and run ls.You can see the deployed files.
In Configuration section => General Settings, check the startup command.
It has to be
dotnet YourAppName.dll
Make sure the dll is available in Bash or SSH.
Update:
We can find the core dumps in LogFiles/core folder.
But initially, it is disabled.
To enable it, we need to add the below command in Startup of the deployed app service.
ulimit -c unlimited
Thanks #Sourabh Edake for the command.
Restart the app. Whenever there is an exception, the core dump will be created in the mentioned LogFiles/core folder.

How dotnet.exe serves blazor web assembly files

Can someone explain or refer to a document on how a blazor web assembly app is served by dotnet.exe process?
So here is what I have done and what I know.
Scaffolded a new blazor web assembly project using the command dotnet new blazorwasm -o BlazorTest.
Ran the project using the command dotnet run and it runs as expected.
Remember I am not using the --hosted parameter to include ASP.NET Core server.
As far as my understanding goes, the output of blazor web assembly project are set of static files which run inside of a browser process. In order for these files to run inside of a browser we need a web server like kestrel/iis or a cdn to serve these files.
Now my question is, in the current setup where is that webserver or cdn present which is required to serve the files?
The dotnet CLI is reading your Properties\launchSettings.json file.
The default profile launches the app using IIS Express.
If you want use the other Kestrel launch profile that is included in the template, you can use:
dotnet run --launch-profile "BlazorTest"
Note: The "project" profile will be scaffolded as the name of the app you specified in dotnet new

Deploying Application Insights bits to another server

I installed the Application Insight SDK from nugget packages and when I run the code I am able to log the telemetry data to cloud. Now I want to move these bits to my TEST server.Can I copy the bits directly to TEST server. after doing this, does the application logs the data to Azure?
I am using ASP.Net Application.I created Application Insight Resource in the cloud with the application type as ASP.NET.
The Application Insights SDK libraries should be deployable using XCOPY (i.e. just copy everything along with your application) without problems. Make sure to include your ApplicationInsights.config file and any changes to the Web.Config file as well.
However, remember that if you want to capture dependency calls in an IIS application, you will need to also install Status Monitor on the Test server as well.

Deploying More Jar files (Own) in server

I am new to deployment and development of web applications.
Suppose I create three jar files and deploy them on a Tomcat server. I use maven to install the jar file and to deploy.
How is it possible to call a method in another jar file?
For example:
I developed a simple application in mytwitter.jar.
Then, I create myapp.jar, where one of the classes needs to call a method in mytwitter.jar.
Do I first deploy mytwitter.jar to the server and myapp.jar later?
You package all of the JARs you need (yours and 3rd party alike) into a WAR file which is what gets deployed to the Tomcat server. So in your maven config you likely already have dependencies configured for things like the twitter API and other packages. Just add your own JARs in there as well and then your code has access to it like anything else.

Reuse Windows Service classes

I have a ASP Net project of the type Windows Service.
When I build that project an exe file is generated.
Now I also have another project os the type Web Service, that uses classes from the previous Windows Service project.
When I build the Web Service, on it's bin/debug folder, the Windows Service exe is there, instead of a DLL.
This way, when I deploy the Web Service on ISS, I get an exception when the part of the code that instatiates a class on the Windows Service project is executed.
The only whay I found to solve this issue, is to make the output type of the Windows Service to DLL instead of EXE, and the Web Service runs correctly.
But, of course, when I try to install the Windows Service, I get this error:
Can I even do this?
Windows Services and web services are different project types. You cannot run the same executable. You have to options:
Either you put the common code into a class library and create a project for the windows service and one for the webservice
You create to build targets.
Option 1 seems to be easier for me

Resources