简体   繁体   中英

Deploy and Run : Visual Studio 2015 .ASP.Net Core Application onto Linux.. How

I have setup a Ubuntu VM so that it can run an ASP.Net Core dummy application via Ketrel and nginx using the information at

https://www.microsoft.com/net/core#ubuntu and https://docs.asp.net/en/latest/getting-started.html

When I do this I run

dotnet run 

in the root directory of the application, which contains

bin  
obj
Program.cs    
Startup.cs
project.json  

This all works fine.

Meanwhile, I have also setup VS2015 and produced a "hello world" ASP.Net Core application on Windows using. https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/using-on-windows

It runs fine from the debugger.

However, what I would like to do is run this on the Ubuntu VM I have set up.
When I publish the project the root directory does not contain the equivalent files in the project I created above, and running donet run or dotnet restore fail as follows

> aec@gfd-Ubuntu-1604-LTS:~/PublishOutput$ dotnet restore warn : The
> folder '/home/bts/PublishOutput' does not contain a project to
> restore. bts@MHR-Ubuntu-1604-LTS:~/PublishOutput$

arc@gfd-Ubuntu-1604-LTS:~/PublishOutput$ dotnet run
The current project is not valid because of the following errors:
/home/bts/PublishOutput(1,0): error DOTNET1017: Project file does not exist '/home/bts/PublishOutput/project.json'.

Contents of the PublishOutput directory is as follows

arc@gfd-Ubuntu-1604-LTS:~/PublishOutput$ ls 
> AssName.dll 
> AssName.pdb
> Class.deps.json 
> Class.dll 
> Class.pdb 
> Class.runtimeconfig.json
> Microsoft.AspNetCore.Diagnostics.Abstractions.dll
> Microsoft.AspNetCore.Diagnostics.dll
> Microsoft.AspNetCore.Hosting.Abstractions.dll
> Microsoft.AspNetCore.Hosting.dll
> Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
> Microsoft.AspNetCore.Http.Abstractions.dll
> Microsoft.AspNetCore.Http.dll Microsoft.AspNetCore.Http.Extensions.dll
> Microsoft.AspNetCore.Http.Features.dll
> Microsoft.AspNetCore.HttpOverrides.dll
> Microsoft.AspNetCore.Server.IISIntegration.dll
> Microsoft.AspNetCore.Server.Kestrel.dll
> Microsoft.AspNetCore.WebUtilities.dll
> Microsoft.Extensions.Configuration.Abstractions.dll
> Microsoft.Extensions.Configuration.dll
> Microsoft.Extensions.Configuration.EnvironmentVariables.dll
> Microsoft.Extensions.DependencyInjection.Abstractions.dll
> Microsoft.Extensions.DependencyInjection.dll
> Microsoft.Extensions.FileProviders.Abstractions.dll
> Microsoft.Extensions.FileProviders.Physical.dll
> Microsoft.Extensions.FileSystemGlobbing.dll
> Microsoft.Extensions.Logging.Abstractions.dll
> Microsoft.Extensions.Logging.Console.dll
> Microsoft.Extensions.Logging.dll Microsoft.Extensions.ObjectPool.dll
> Microsoft.Extensions.Options.dll
> Microsoft.Extensions.PlatformAbstractions.dll
> Microsoft.Extensions.Primitives.dll Microsoft.Net.Http.Headers.dll
> refs System.Diagnostics.Contracts.dll System.Net.WebSockets.dll
> System.Text.Encodings.Web.dll web.config

Is there a method documented anywhere which details how to produce and publish an ASP.Net Core application on Windows under VS2015, and then deploy it and run it on a Ubuntu machine?

Have a look at the .NET Core Application Deployment article in .Net Core documentation .

Since it looks like your application is a portable app (which is the default), you run a published version of it using dotnet AssName.dll .

Here are the steps:

  1. Click On Search On Your Computer or Online
  2. Add Asp.net core
  3. Install and add C# extension.
  4. then Create Application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM