Hosting ASP.NET Core application on shared Linux hosting - c#

Now asp.net core has been released so we can develop/deploy .net application on any platform.
I am trying to play with asp.net core and able to run my application on ubantu os(On Virtual Machine). But i just wanted to hosted dot net core application on shared linux hosting environment where simply upload published file.
I was following Tony's blog, to play with core.
We need DNVM, DNU and DNX to run application, but we don't have terminal to execute these commands on shared hosting.
Help me figure out the solution.

It is somewhat possible... and actually, Scott Hanselman just did it using .NET Core 2.1 (still in preview, although). He got it running on GoDaddy's shared Linux plan. You may follow his step by step here, but you are strongly adviced not to do it.

Related

How to Pick which Framework Version to Build app for C# Visualstudio

I am very new to C# development. Like Youtube tutorial new. I am trying to build a console app to install services to our servers. Is there a way to pick which .Net version you want to use to build the application? So that I the writer can tell the user which .Net version they should have in their system for the console app to run?
I am using Visual Studio 2019
Thanks to #David Browne's comment under my original post all you need to do is make sure to select .Net Framework version of the Console Application template in Visual Studio project template. Not .Net Core. I wasn't aware there was a difference:
"You set the Target Framework in the Project Properties. But the Project Type determines whether you're targeting .NET Framework or .NET Core"
You have 2 options to get started
.NET Framework - Apps build using .NET framework can only run on Windows. This is an years old proven and secure stable, mature eco system
.NET Core - Apps build using .NET Core can run on Windows, Linux and Mac. It's cross platform and open source. Latest is v5.0.
I recommend you to use the latest .NET Core v5 for your new projects. It's stable and Microsoft is well supporting it. .NET Core much is powerful, faster and optimized.
You can create different kinds of apps using .NET Core. You can create simple console apps, libraries or asp.net core web apps. MVC and WebAPI are supported. As you mentioned, if you want to create a service, There is "Worker Service" project available for .NET Core.
If you create a Worker Service it can run as a Windows Service in Windows machines and a Linux Deamon in Linux machines.
Visual Studio 2019 got well with .NET Core and it's features.
If you need to run a .NET Core project in Windows, Linux or Mac machine, you also need to setup the deployment machine installed with .NET Core runtime. It's available free from Microsoft website. Download.. Install.. Run. That simple

What is the correct order of installation for running a DotNet Core web application on a local IIS server?

I run a local IIS Server with a DotNot Core 2.1 application deployed to it. I like to keep up to date with the latest security patches that are released monthly and I use the Core download page to do so.
My question is, what ALL do I need to install each time and in what order. I usually find a Framework installer and I chose the SDK just to make I have everything. Then I find a ASPNET.CORE installer and I run those in. Finally, I run the Web Hosting Bundle.
Am I doing too much? Do some of these items copy over the same assets? What is the correct proceedure?
If you need to host an asp.net core web app, follow the Host ASP.NET Core on Windows with IIS Guide.
In terms of installing things, follow the Install the .NET Core Hosting Bundle Section
The bundle will install 3 things:
.NET Core Runtime
.NET Core Library
ASP.NET Core Module (for IIS)

Launch ASP.NET Core Web-API programmatically

How do I launch an ASP.NET Core Web-API programmatically from C#? The API should launch after I click on a button in a form.
I already added my API to my solution via Add -> Existing Project... but I don't know how to launch it from a different Project.
The Web-API is running on .NET Core 2.0 and I want to launch it from a project using .NET Framework 4
Probably you are looking for something like this(link)
dotnet run [-c|--configuration] [-f|--framework] [--force] [--launch-profile] [--no-build] [--no-dependencies]
[--no-launch-profile] [--no-restore] [-p|--project] [--runtime] [[--] [application arguments]]
dotnet run [-h|--help]
You can also try to run the application as a Windows Service, and start the service on click.
Here is a sample project showcasing hosting of ASP.NET Core app in WPF: https://github.com/mkArtakMSFT/Samples/tree/master/WpfAspNetCore
Couple of things to pay attention to:
The .NET Framework 4.6.1 is the minimum version which can host ASP.NET Core apps
This sample is dummy and doesn't have much configuration (based off of empty ASP.NET Core Web app template content). You can, however, add reference to the Microsoft.AspNetCore.Mvc package to add support for MVC.

Where to configure Razor page language version to C# 6?

Recently I've tried to use some C# 6 new feature (interpolated strings) in my ASP.NET MVC (5) .cshtml view, but when running got an error message complaining about the $. It is clear the compiler in C# 5 compatibility mode, or worst it is a C# 5 compiler.
When in editor a popup warning warns me (I do not know it is VS or ReSharper) Feature 'Interpolated strings' is not available in C# 5. Please use language version 6 or greater.
The project itself was set to C# 6, and I can use C# 6 features in my build time compiled code like controllers etc.
Q: Where should I set page compiler version, and will this C# 6 compiler available when I deploy my web app to Azure there?
From String interpolation in a Razor view?:
This only works in MVC6. Alternatively, also from a comment on this link, you'll need to add the roslyn code dom package from ASP.Net.
<div>
#($"Hello {this.Model.SomeProperty}")
</div>
As far as Azure is concerned, please see this link. http://azure.microsoft.com/blog/2015/08/11/update-on-net-framework-4-6-and-azure/
With great power… The tooling, framework and Azure platform teams want
to ensure the powerful tools we give you to help build your dream is
matched by the responsibility we recognize we have to keep it running
in the cloud. At the time of the Visual Studio and Azure SDK 2.7
releases, Framework 4.6 wasn’t supported broadly throughout Azure.
This is due in large part to the fact that just as many teams (or
more) are responsible for the ongoing development and stability of the
Azure platform.
For now, we have an update on the availability of .NET Framework 4.6
for Azure App Service and an article demonstrating how to get .NET
Framework 4.6 working in your Cloud Service roles.
Azure IaaS
For customers using Azure’s Infrastructure as a Service
(IaaS) services, installation of .NET Framework 4.6 is manual. To
install .NET Framework 4.6 on an Azure IaaS virtual machine, the
process is as simple as logging into the virtual machine using Remote
Desktop. Once on the machine, the .NET Framework 4.6 installer can be
downloaded and installed directly onto the virtual machine. Customers
using Azure Automation could also choose to automate the installation
onto Azure virtual machines using PowerShell.
Azure App Service
Update The Azure App Service team is nearing the end
of the testing phase for .NET Framework 4.6 and planning the
deployment to the environments. Currently, the plan is to roll out the
updates to Azure App Service during August 2015.
Azure Cloud Services
Saurabh Bhatia authored an article in the Azure
documentation center outlining how to install the .NET Framework in a
Cloud Service Role. The content has been recently updated to include
commentary specific to .NET Framework 4.6. You can find the updated
article here on the Azure documentation center.
For me installing the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package solved the problem.

Does the ASP.NET framework have to be installed to run at vb.net Console Application?

Question, I have a need to run a vb.net console application across a multiple servers. I'm wondering if the ASP.NET framework is required to be installed on each of the assets in order to run?
No, ASP.NET is not required. However, appropriate version of .NET Framework is required to be installed on the machine that is supposed to run the application.
I think your understanding of the terminology/technologies is slightly skewed:-
ASP.NET is a web application framework (more info here). In order to run a Web Server that serves up ASP.NET pages you will need the .NET framework installed on the Web Server Machine. Clients that connect to the web server do not need the .NET Framework installed as they just use a web browser.
If you want to run a console application on any machine, that machine needs the .NET framework installed on it.
It makes no difference if the console application or web application is written in C# or VB.NET, the same rules still apply.

Categories