Host MVC app on Azure Service Fabric - c#

Looking into options for starting the migration of an existing application with both MVC web pages and Web Api components to Service Fabric.
We have gotten the Web Api components running under ServiceFabric, but not the MVC web pages.
Based on what little I have seen out there, there does not seem to be a definitive way to run an existing MVC application under service fabric. Is this correct or am I missing something?
NOTE - by MVC app, I mean a web site built using MVC 6, not Web API services.
Thanks in advance.

Yes you can take an MVC 6 application and run it on Service Fabric. Here is an example from the official Azure Sample gallery: https://github.com/Azure-Samples/service-fabric-dotnet-iot/tree/master/src/Iot.Tenant.WebService

If you are planning to develop new application then you can follow below link service-fabric-add-a-web-frontend
IF you have an existing application you and you don't want to change any code you can deploy your application as Guest executable. follow below link service-fabric-deploy-existing-app
If you have an existing application (MVC 5 and IIS based) and you want to deploy in Service Fabric you and host with help of container. MVC5 app does not support self-host and tightly coupled with IIS. check below link iis-based-applications-to-service-fabric-using-docker-container

Related

use owin to self host web api

I'm self hosting web api using owin on client-server application based on MVC architecture. I see a lot of code examples that shows that the Startup class with the configuration, and the Program class with the Main method that start the owin self host "using (WebApp.Start(url: baseAddress))" - are at the same project. Should I desperate owin self host to one project so the WebApp.Start will be in one project, and web api with Startup claas to another one, with all the controllers and so?
The common answer is that it depends. Usually self host applications is very simple to provide some simple functionality. In that case since both parts are simple there is no need to separate them (host code and Asp.Net Mvc) and they can be placed in one project as an application layer. But if you are trying to add some complexity to host code (e.g. some warm up of Asp.Net Mvc app), then may be you should split your host code and Asp.Net Mvc app code in to two projects.
Found that it might be good idea inspired by separation of concerns: the self host should not know about the server and the opposite. Owin and web api have different job so they need to be separated.

How to run ASP.NET web api from github

I am new in asp.net and angular development.I dont know how to run asp.net web api from github. As we run angular code by using "ng build --prod --base-href https://ownername.github.io/repositoryname/ so i want to know could we run asp.net web api by using such kind of any command or something other which is used for this.
Basically i want to run my project on network i tried by IIS server but no result is showing so now i want to try github process
Help would be appricated
asp.net core apps have to run in a .net core process on a server so the hosting environment needs to specifically support this. a variety of web servers can be configured to proxy the requests. Unfortunately, I don't think GitHub allows running app processes for asp.net core.
However you ca easily deploy to azure with even a free account
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-2.2

Building a REST API for mobile apps(Android & iOS) for an C# asp.net ecommerce website

I am new to APIs development and have to start building a REST API for the e-commerce website to be built and can be used by 3rd party: mobile app development company.
The eCommerce site is written in C#, ASP.net.
I have read about SOAP, REST, RESTFul on google.
My doubts are :
Where do I start? I have never created any API's before. Please mention the steps to start over.
The REST API is to be used with both Android and iOS mobile app. So, do we have to create a different client application for both?
Do we use some frameworks? If yes, then which frameworks to use?
As the website is written in dot net. Do we use Java or dotnet for REST API development?
What is the best way to create the REST API for mobile apps?
Please help me with my doubts.
Thanks in advance.
Here is Tutorial to build RESTFUL API in .NET.
My knowledge is in ASP.NET so I leave the Java guide for experts in that field.
RESTful API provided by Microsoft - which is called Web API - is a part of ASP.NET MVC, so you should start learning ASP.NET MVC, it's pretty easy for ASP.NET guys to learn ASP.NET MVC.
No, when you developed your Web Service, both iOS and Android would be able to communicate with your Web Service.
For Authentication, you gonna need libraries like Owin.
Since your main website is in .NET and not MVC, you should keep the Web Service files separate, for this, you can put Web Service file in a separate folder on the same host which the main website is, then create a sub domain to access the Web Service. By the way, you can create your Web Service using Java too, since it is separate from the main website, it makes no difference which technology you use.
The best way to create a REST API for a mobile app is if it is done by an expert! ;) There are many tools and frameworks out there that can be used to create RESTful Web Services, each one of them has some pros and cons, I prefer to use the one I know the best, which is Microsoft ASP.NET Web API, you should choose based on your current expertise.
P.S. If you gonna start learning ASP.NET MVC, I recommend to learn ASP.NET Core, which is the latest version of ASP.NET MVC, and is the future of this technology.

Azure restful webservice

i'm trying to create a restful webservice and deploy it to Azure.
I can't figure out how this should be done. The MS documentation is huge and doesn't say much on how to achieve this.
I created a Cloud Service Azure Project and included a ASP.NET MVC4 WEB API WebRole and Visual Studio automatically created a website.
WebRole is the entry point for the service right? I don't see how the WebRole is connected with anything in the project. I guess i'm totally missing some parts of this architecture.
Can you please tell me what's the best way to achieve this or point me to some helpful tutorials?
When should one choose to create a WCF Cloud Service?
Thank you!
Step-by-step instructions for creating a RESTful API in MVC in Windows Azure are here. You should not be thinking about hosting a RESTful API in WCF - while possible there is a lot of unnecessary overhead.
If you are into Node.js, you might want to look at the new Custom API feature in Windows Azure Mobile Services.

Can i deploy ASP.NET website NOT ASP.NET Web Application on windows azure?

I have tried to deploy an asp.net website NOT asp.net web application with windows azure, so i need to know if i can do it?
Yes you can.
I was at a conference by Scott Guthrie one of the head developers on Azure.
He was demoing standard ASP.Net websites.
The following link tells you how to deploy a site:
How to deploy an asp net website to windows azure
Hope this helps.
When you are creating a new Role, you required to select what type of the Role you need. Such as Web Role, WCF Web Role, Worker Role etc., That will automatically add the Role into the Cloud project. When you select an ASP.NET Web Role, you will be getting a Web Application instead of Web Site.
But once you added the role, you can extend the role with multiple Web Site, Web Application and even virtual Directories.
You can have a quick look of following url -
http://www.dotnettwitter.com/2012/03/publishing-multiple-sites-sub-sites.html
http://www.dotnettwitter.com/2012/03/publishing-multiple-sites-sub-sites_29.html

Categories