Web API and .NET Standard - c#

Context:
I'm currently on application including many subproject based on .NET Standard (for Xamarin).
This application need to run Kestrel Web Server to expose an API (application must be callable from external to receive updated datas).
So, I have created an ASP.NET Core project permitting to make easily a WebApi and run a server (Kestrel). Problem, It's a .NET Core project and it's incompatible with Xamarin.
Objectives:
The application must be callable from external (expose an API)
The application must used .NET Standard Projects (compatibility with
Xamarin)
The application must run on desktop and mobile
Questions:
Will WebAPI included in futures releases of .NET Standard?
Does it seems complicated to expose an API (and so, run a server) in
mobile app (and not a good practice by the way)?
Is there any other way to do this work?

Objectives:
•The application must be callable from external (expose an API)
Get a web server serving as middle man and passing the request it got from external then it should be doable
•The application must used .NET Standard Projects (compatibility with
Xamarin)
Web API runs on server and Xamarin runs on mobile/Desktop, Xamarin shouldn't have to worry about what tech stack the server uses as long as it complies with the protocol both agrees on (http)
•The application must run on desktop and mobile
Not an issue
Questions:
•Will WebAPI included in futures releases of .NET Standard ?
Definitely yes.
•Does it seems complicated to expose an API (and so, run a server) in
mobile app (and not a good practice by the way) ?
Totally wrong way to do it. your app will lost internet connection whenever the phone decides to sleep for a while plus the phone is just not designed to serve as a server.
•Is there any other way to do this work?
Get a real cloud server instead and run your API there.

Related

how to add a simple web page to a Windows service developed in c#

I've developed a Windows service. It installs, runs and serves its purpose. To view the results it produces, I'd like to add a simple web page with Select * from the database the services works with.
Would someone please elaborate on how to make Windows service serve a web page?
Ideally, I'd like to learn from the code of a similar project
ps. IIS is already installed on the host where the service runs
Turned out easier than I thought https://www.youtube.com/watch?v=YUPg41kG_kw&ab_channel=BoostMyTool
I've achieved something like this by making use of the Worker Services in .NET Core and configuring the service to run as a Windows Service.
And because I had a worker service in .NET Core, I could easily add HTTP workloads like MVC or Blazor.
In my example, I had a windows service running worker tasks as well as a Blazor UI to show the details of what was happening (I scaffolded the Blazor code fist and then added the worker via AddHostedService).
The benefit of this is that the .NET Core is acting as the server do this process didn't need IIS on the platform plus both areas of the system are part of the same process.
If the above isn't suitable (or requires a huge migration to .NET Core), then I'd suggest using Named Pipes to communication from one process (your windows service) to another (your web-app).

API written in C# using nancyfx running on WampServer

I am still relatively new to writing API's and web services, so bear with me if I use incorrect terminology.
I want to know if it is possible to create an API in C# using nancyfx (or any other framework) or even just a simple web app and then set it up as a continually running web service using WampServer. I'm pretty new to Wamp, all I have done so far is create a few rudimentary pages with php; but I can't seem to find any information about running a web service with Wamp using a different back end language other than php.
WAMP is stand for Windows Apache MySQL PHP. As I can say, you can't run a C# web service with it base configuration. However, you actually don't need this. If you are on .net Core, there is a Kestrel web server. You can use it to serve your app. On a .net framework you have a HttpListener which can help you to implement self-hosted web service (for example, a windows service which hosts your application).
There are many other options, btw. Try google for some kind of "Hosting .net web application" or "Self-hosted .net web application"

HTML5 with .NET backend App, compatible with both standalone Windows and Azure?

I need to design an HTML 5 responsive, and simple app that should work on both internal Win server and on Azure.Our Client wants to check out Azure but maybe later he will want this app to be on its own on premise servers. Our Developers are almost all .NET back ends, with basic knowledge in HTML 5, Javascript, Jquery, and bootstrap. We accepted the challenge because the project is tiny and interesting, the point is, is possible to have 1 project that can be deployed to azure or IIS with no problem? and what kind of project should we create? I think that a simple asp.net project with some web methods and js will do the job, but I don't know if it will work on azure too. Back n 2010 I did something that way but now I am not sure it's still valid
Important: the web application should be able to query oracle on premise server, via web service but not sure if take azure service bus or azure vpn
It depends on how you build your application. I have built applications in the past that works both on-premise and on Azure. As long as you don't access any Azure specific features, there's no problem to deploying the web application project to an on-premise IIS.
If you use Azure-specific features or services from Azure, such as Azure SQL DB, you have to built an on-premise version. In my case it was simple as changing the connection string and the rest was done by Entity Framework, but you can use an IoC container, such as Unity, to change your implementation based on the environment you're running on. If the Azure environment is available (check through RoleEnvironment.IsAvailable) you resolve the Azure-specific implementation of some features and if not the on-premise implementation. In most cases that are just a few dependencies, for example if you use a worker role on Azure and a Windows Service on-premise.

server side framework for ios apps

I am new to the IOS app development. I go through the apple developer portal they use Objective -C as their server side framework.
The main problem is I need to develop the app in one month and I know C# web service or java server side framework.
Does these frameworks are supported by the iOS apps API. Please suggest me.
And if possible give me some reference for these existing frameworks.
Thanks in advance
Usually an App communicates via an HTTP service (usually a REST service) with a server. The server can be written in any language which can be used to provide a REST service. For example ASP.NET Web API if you are familiar with .NET and C#

Do .Net versions have to match between web service and web site?

I have an existing website that is currently using .Net 3.5 and must stay that way because of our sharepoint integration. I need to write a web service/web api that the website will interact with (a method to send an email, for example). I also need to write a windows service that is going to do the same thing. The windows service will probably be .Net 4.5.
What framework should I use for the web service/web api so both environments can interact with it the best?
The very nature of web services, soap or rest, is that they are platform agnostic. This also applies to .net versions, you can have whatever version at the server and another version at the client and this surely will work.

Categories

Resources