Application Insights in .net core API + WebJob - azure-application-insights

We have a .net core (3.1) API connected to Application Insights with AddApplicationInsightsTelemetry in Startup's ConfigureServices, as documented here.
We also have a web job in the same API. The logging there does not work without an extra configuration. For it to work, we connected again to Application Insights with .AddApplicationInsightsWebJobs in Program.cs, as documented here.
However, if the configuration for the web job is applied, we stop receiving API's logs of type "request" and "dependency". Without those also other Applications Insights features aren't available, like the application map.
Are we doing anything wrong or missing anything for having Application Insights working for both the API and the web job?

Related

SignalR, SharePoint, Owin issue

There is a scenario where we have two applications. One is share point and other obe is Web API.
For security point of view, we need to deploy second stand alone project into the firsy application.
In IIS, I deployed one application. In that folder I deployed another application and make it as web application.
Now everythings runs fine. SharePoint applicantion consume APIs correctly.
Now, I have include signalR to both application where web api application is server and share point is client.
I have global asax file and add startup file for owin signalR. If I add owin automatic startup to false then application runs fine but signalR will not work.
If I start owin then neither api work nor signalR will work.
Important point is when I run SharePoint application from IIS and run web api from visual studio and set path of web api for signalR then it works fine.
What could be the issue?

Web API as a windows service

So I'm creating a new .Net Framework 4.8 Web API in Visual Studio 2019 and I'm wanting to know how to create the API as a windows service? I can't seem to find any examples or online resources to do so. I can run the API locally in VS and it opens Chrome and shows the responses under the local IIS Server it spins up. How do I take this same project and compile it as a windows service while still using HTTPS?
Web API is fully capable of being self hosted on top of OWIN, and does not require IIS to run.
Web API self hosted is basically just a console app. So the techniques for turning a Web API console app into a Windows Service are the same as for any other .NET console app. You can use a service manager such as NSSM, or create a Windows service project directly (by inheriting from the appropriate classes, pretty messy) or use a library like TopShelf.
Note that it's generally not a good idea to directly expose this self hosted app directly to the public. IIS provides a lot of security benefits out of the box designed to protect against malicious requests. If you're planning to publicly expose it, make sure you stick a proxy in front of it that will fulfill those security needs.

Service Fabric reliable service with .NET Core

So I am playing around with Service Fabric for rolling out a system to the cloud, and so far I have most of the stateless services ported over and running well using ASP.NET Core.
I have another set of services that need to be stateful, and I would like to leverage .NET Core for those services as well. For those I will need to run a custom TCP protocol, not HTTP/WebAPI/WCF.
So the question is; is this possible? The templates only have a ASP.NET Core stateless service template. Can I build something like a .NET Core console application to run as a "Reliable Service"? If so, is there any documentation on how to do this?
Yes, it's possible.
You can create the .NET 4.5.1 stateful service via the template, and then port that project to .NET Core - we've done this and it works just fine.
There doesn't appear to be any official documentation on this process.

Web.Api 2 and Asp.Net core in one solution

Currently we use ASP.NET core project for our UI. There is need to add an OData service to it. As far as I understand it is not supported well enough yet, so it was decided to implement it in a separate Web.Api 2 project.
Is there someone who has such an experience?
Is it a way to go?
May I encounter troubles with deployment to Azure?
Any ideas and thoughts would be appreciated.
If you hosted the web site on a different web application, then you have to enable CORS on the web API, and you have to test it during development to avoid any issues.
You can overcome this issue by deploying both the UI and API to the same Azure Web App. you can have the UI under the root and the API under a virtual directory, ex: apis

Calling WCF service from jsp page

I have created a WCF Service and published it to a Windows Server running IIS. In an asp.net web application, I can add a Service Reference to the WCF Service which exposes its methods which I can call. This all works fine.
I need someone who is running a jsp site to be able to call a method in my WCF Service. How can they do that? (I know absolutely nothing about jsp). Presumably they cannot reference my WCF Service within their application in the same way you can within a .net application.
The web services are totally platform independent. Therefore, someone writing in Java should have no problem calling a web service server, regardless if it was written using WCF or another platform. For example, here, here and here you could find some tutorials on how to build web service clients using java. This java code could be called from JSP pages.
If you want to quickly test your web service from the client side, you could use SoapUI. It's a web service client tool developed in java. I am sure you will find it useful.
Hope I helped!

Resources