How to migrate Web API 2 to Azure Mobile App - asp.net-web-api2

How to migrate Web API 2 to Azure Mobile App?
I have an existing Azure website hosting both MVC4 and Web API 2. I searched and could not find instructions (step by step guide) to migrate to Azure Mobile App; what NuGet packages to add/remove and what code add/change/remove.
The best I find was migrate from Azure Mobile Service to Azure Mobile App (this and that).

Here are the steps I did to configure an Web API 2 API controller to support Azure Mobile client.
Add NuGet package Microsoft.Azure.Mobile.Server
Add MobileAppController attribute to ApiController class
//ADD THIS
[MobileAppController]
public class MobileController : ApiController
Note: To query API from browser or POSTMAN without getting error message about wrong version, set the following in web.config file
<add key="MS_SkipVersionCheck" value="true"/>

Related

Does Service Principal (SPN) values has to be change while doing ADAL.Net to MSAL.Net migration?

We have a Web Application in .Net Core 6.0 that we have registered in Azure AD app registration in azure portal.
We have used ADAL.net library in our code for Authentication. Now, we are migrating authentication library Adal.net to Msal.Net.
We have used below endpoints URLs to generate tokens
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
When we migrate the application, we have to change the library references and related code in our application.
We want to confirm on the below points -
Do we need do any changes in app registration configuration in azure portal or any code level configuration changes in application related to MSAL.Net Library like in appsettings or startup.cs class?
Do we need to do any change in service principal (SPN) values?
If you are on ASP.NET Core 6.0, you should use Microsoft.Identity.Web, which provides higher-level APIs on top of MSAL.NET. See the migration guide here. You do not need to change any of your app registration when migrating, include the service principal values.

Host Asp.net Core Web Api locally

I am learning Asp.net Core Web Api. I need to access the api from a flutter application but am not ready to host the api on Azure. What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
There are several ways to go about this, here are some options:
FROM VISUAL STUDIO: You can simply run the ASP.NET Core Web API from Visual Studio in Development Mode by Pressing F5
FROM COMMAND PROMPT: Run the API Project from the command line by opening a command prompt window in the root project folder of the project and use the dotnet run command. See here for more info about the command: dotner run command
HOSTING IN IIS: I am assuming you are running a windows OS. You can turn on IIS and its features. Simply follow the instructions on this page: Host ASP.NET Core in IIS on how to deploy ASP.NET Core to IIS. The advantage of this is that you have the application always running while you work on your flutter application locally.
I hope this helps you resolve your situation.
What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
If your application is developing now, there is no need to host the application and let the Flutter app client to access. We could build some json file as the right format like web api response to develop the client app.
If your client application and web api has now developed successfully, you want to host the web api to let fluent app or other application to access from internet. You should have a public IP address and host the application on IIS or else. Public IP address you should ask for the IP provider company. Without a public address, the client side app couldn't access your application from internet.
If your web api and the client app are in the same intranet, you could let the client app directly access the web api after the web api hosted on IIS by using hosting server's IP address.
About how to host the asp.net core application on IIS, you could refer to this article.

How can I deploy multiple Stateless web API independently, which are under one Service Fabric Application?

I have 3 web API (Stateless Web API) under Services in Service Fabric Application (One Application).
On the cluster explorer, it shows one Application >> Types >> then all 3 Services. Its deployed and works good but I couldn't deploy the Web APIs independently.
How can I deploy the web api independently? Should I create 3 Application and add 1 Web API each or Should I keep it as it is (One Application and 3 Web API underneath) ?
The Goal is to have the ability to customize the APIs anytime and deploy them independently without affecting others.
I tried 3 Application and 1 Web API each approach but got deployment error on the new applications: error in XML document (7, 4)
When you publish the SF app, you can just upgrade the manifest version of the stateless web api you want to deploy. The deploy will only replace the service in the cluster that has an upgraded manifest version.

Dynamically Create Web App In Azure Via Code

Using Azure, is it possible to dynamically create a web app and copy/publish files to that new web app via an Azure API? Here's my scenario:
1] Customer signs up for services in our application
2] We want to automatically generate a subdomain for the new customer (i.e. customername.ourapplication.com)
3] We want to create a copy of our core files for our web app into a new Azure Web App that the subdomain is pointed to.
Does this type of automation exist in Azure? If not, what other services are out there that can do this? We've seen it happen with other apps across the web and were wondering where we should start.
Yes, the Azure Resource Manager (ARM) API allows your to provision and modify Azure web apps.
You can access the ARM API directly via the REST Api, via Powershell commandlets, or via the Azure CLI api

Web Service on Windows Azure?

I am new to Windows Azure and I have a question.
I have:
Web site which deployed to Windows Azure - The web site manage a table (add, edit, delete). I used this guide: Deploying an ASP.NET Web Application to a Windows Azure Web Site and SQL Database
Andorid application & iOS Application (Native Code).
Now, I want the mobile applications to get data (in JSON format) from the web site (and from the DB).
What is the best practice to do that?
I tried to create a Azure (WCF) Service (the project refrenced to the web site project) but I didn't succeded. If this is the way - Is anyone knows a good tutorial to do that?
Is there another option? Maybe from the web site itself?
Thank you very much,
Yuval
If you want to integrate with non-Microsoft technologies I suggest you take a look at the ASP.NET Web API which allows you to build REST services using content negotiation. Content negotiation allows your consumer to specify the format it requires (json, xml, ...).
To host the ASP.NET Web API in a Windows Azure Web Site you should take a look at Carlos' blog, he describes in detail what you need to do to make this work: Creating ASP.NET Web APIs on Azure Web Sites
Have you given ASP.NET Web API a look-see?
http://www.asp.net/web-api