A way to publish ASP.NET 5 to Azure Cloud Service? - asp.net

A noob's question. I consider using a Cloud Service instance to host a web-app, but my app is based on ASP.NET 5 beta8. Visual Studio tooling doesn't allow me to add an ASP.NET 5 app into a Cloud Service project (which could make it trivial to deploy).
However, it is still just an app. So there must be a general way to put it in, right? Or is it possible only through VS tools?

Your question is a duplicate of: How to convert a ASP.NET 5 Preview Web Project to Cloud Service
The answer in that thread:
It's not supported yet. But, if you want, you can create a setup script that installs all the needed components and then you can follow the steps from this post to run it and bootstrap your app: http://www.codeproject.com/Articles/331425/Running-an-EXE-in-a-WebRole-on-Windows-Azure

Related

Deploy Single Page Application to Azure Cloud Service

I am currently creating a dashboard for a complex backend that should be hosted on an Azure Cloud Service due to performance reasons. Unlike our older projects we want to implement our dashboard as single page application based on vue.js, but after doing some initial research I am aware of difficulties when it comes to deployment.
The idea is to have a frontend project and an ASP.NET Web Api that offers the respective data for the dashboard. Both projects should run inside the cloud service.
What would be the best approach to deploy single page applications to a cloud service? Since we prefer Visual Studio Code over Visual Studio for frontend-related tasks, it would be great if we won't depend on specific features VS offers.

Asp.Net core Web API calling

I am new in Asp.net Core and trying to clear my concept on web api. I have basic knowledge on web api. I can do CRUD operation using web api by running that web api project and calling it in other web application project at a time.
My problem is,
I add an web api in a web application project named "Api_BusinessUnit".
How can I call this web api in a controller named "BusinessUnitController" shown in below image. My confusion is, Both are in a same project, I can run one project at a time. So how can I use this web api in "BusinessUnitController" ?
Thanks in advance.
Why do you want to have one Web API call another in the same project? If you need to communicate between parts of your project, you can do so directly without having to over the web, which will be much better from a performance perspective and will be more reliable as well.
That said, looking at your image, I think you have two separate web projects in the same solution which isn't the same thing at all (you may wish to update your question if this is the case). To have one project communicate with the other project, you should determine the URL of the destination project and call it as you are doing. You also will need to ensure both projects are running, of course. You can launch multiple projects at once when you hit F5/ctrl+F5 as shown here:
http://ardalis.com/how-to-start-multiple-projects-in-visual-studio
For me, I am a Scott Allen fan and he explains the project structure for the particular structure you are trying to create here.
https://odetocode.com/blogs/scott/archive/2013/07/01/on-the-coexistence-of-asp-net-mvc-and-webapi.aspx
However, I am a fan of best practices and SoC, so the proper way, IMHO, is to have one solution with multiple projects and either keep the entire solution in version control, or have the project solutions separate, build and deploy to a directory will all of them for testing.
Then the key factor to running MVC and WebApi as different projects in the same solution, besides making sure that Microsoft.AspNet.WebApi.Core is installed, is that the start up project is the MVC and the WebApi references that MVC. Then you're off to the races.

Implementing Angular 2 with Asp.Net Web Api

Could anybody please help me out regarding how to implement Angular 2 with Asp.Net Web API? Any tutorial link would be helpful.
There is very little to no documentation available in this regard.
I did implement the https://angular.io/docs/js/latest/quickstart.html
But it requires npm start which starts the node server useful for CommonJS module loading. I want to use IIS and Web API. Can I use CommonJS or do I have to use any other module system
If I use CommonJS with IIS development server I get this error:
in the console. The same link works fine when I start using Node server. This means on the production server I have to use Node as well as IIS for Web API? Is there any way I can use Angular 2 only with IIS and possibly eliminate CommonJS if needed. Any tutorial to Angular 2 with Asp.Net would be helpful.
You have to use SystemJS as your module system, if you want to use it exactly like in the tutorial. If you want to use CommonJS, use something like Browserify.
You can have a look to following article for Angular 2 and Asp.net MVC with Web API.
https://www.codeproject.com/Articles/1181888/Angular-in-ASP-NET-MVC-Web-API
It's a good one but this article uses Asp.Net MVC in the middle.
You might consider to remove Asp.net mvc part and develop a website with Angular(client side) and web api(server side).
This one is a simple example.
https://github.com/thinktecture/apisummit-2016-angular2-webapi
On the other hand, if you want to use IIS then you need the build your angular project with
ng build --prod
and move the dist folder into your IIS website folder. Note that you don't need a node server on IIS because nb build transpiles old the typescript files into javascript and gets the other static files(html, css, js, etc...) and prepares for you to deploy to any web server like IIS.
another sample angular(client side)-Asp.Net Web API(server side)
https://www.youtube.com/watch?v=AYgs0kLjTLE

How to add multiple web applications in one web role?

I want to add two applications inside one web role in Windows Azure. I'm using Visual Studio 2010.
There are a couple of ways of doing this.
The azure web role accelerator supports having multiple sites in a single web role (see https://github.com/microsoft-dpe/wa-accelerator-webroles). The documentation online regarding this is a little out of date due to the project having been discontinued. However its simple to setup. Just download the stuff from Github, compile and deploy the project from the download to your azure web-role, this then gives you an admin site where you can setup multiple applications within the web-role. You then deploy your application to there using web-deploy.
You can also add multiple sites to the service definition file, see http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/ for an example of doing this.

ASP.NET Web Forms Applications on Azure (or any cloud hosting)

This is a pretty vague question but I'm struggling a bit to get my head around what is involved in cloud hosting.
Say for instance if I had an asp.net web app using:
- Webforms
- linq to sql
- an sql server database
- Calling some external restful webservices
What would need to be done to host it on a cloud service?
Are there specific code changes that would be required and do these need to be considered in the initial design?
Can sql server and linq to sql be used in this type of setup?
What platform if any would be best suited?
in it's most basic form, Azure is just a highly available web-hosting environment - if you have an ASP.Net web application, you can deploy it to cloupapp.net and it should work.
To try it out, get yourself a Vista/7 machine, download the Azure SDK and VS Tools, and create a new Azure application. There are 2 main parts at this point, the Cloud project, and an ASP.Net Web Application. The ASP.Net will have a "web-role" relationship with the Cloud project. This is as it sounds, it is the visual front-end to the Cloud application, that interacts with visitors.
You can, at this point, just leave it there - it's a normal ASP.Net application with very good hosting. Your SQL connection strings should work, though you may want to consider SQL Azure. You can also host WCF services.
As Manoj points out, Azure does have a different programming model which you can take advantage to produce very robust applications. Azure also has the concept of Worker Roles, which are similar to Managed Services, in that they perform processing without a public interface. Instead, your web-roles take the requests, place them on the Queues, and the worker-roles then pick them up, process and send back responses.
It's a very powerful system, which I haven't fully explored, but the good news is that you don't have to be an immediate expert in the whole system, but can create simple ASP.Net sites as web-roles, deploy those then expand from there.
Have a go, it's well worth it
Toby
AppHarbor is a .NET Platform-as-a-Service. We can host your ASP.NET websites more or less un-modified and without the Visual Studio plugins and other crud that Windows Azure requires.
It depends on what type of cloud hosting are you looking for. There is some cloud hosting which will just give you space for application data like Amazon. While Azure gives you complete application framework which supports your application to be hosted in cloud. But programming in cloud is different programming paradigm than in traditional web form. You will have some limited classes from .Net framework available but better resources for scalability.
You cant directly use sql server in azure application. What you can use SqlAzure services.
Just referring a book which i feel would provide you the answer
Cloud Computing Book
EDIT :
Check this microsoft link
Ramp Up
yes, it is supported and live demo of Asp.NET 4.5 Web Forms available on Microsoft azure websites... you can visit this link for detailed information
Create and deploy a secure ASP.NET Web Forms app with Membership, OAuth, and SQL Database to Azure App Service

Resources