diff --git a/GR.Mvc/.bowerrc b/GR.Mvc/.bowerrc deleted file mode 100644 index 6406626..0000000 --- a/GR.Mvc/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "wwwroot/lib" -} diff --git a/GR.Mvc/GR.Mvc.csproj b/GR.Mvc/GR.Mvc.csproj index fc750bb..e766788 100644 --- a/GR.Mvc/GR.Mvc.csproj +++ b/GR.Mvc/GR.Mvc.csproj @@ -1,23 +1,11 @@ - + - netcoreapp1.1 + net10.0 + disable + disable - - $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; - - - - - - - - - - - - diff --git a/GR.Mvc/Program.cs b/GR.Mvc/Program.cs index 3509a7d..ecebef8 100644 --- a/GR.Mvc/Program.cs +++ b/GR.Mvc/Program.cs @@ -1,25 +1,27 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Hosting; +using GR.Services; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; -namespace GR.Mvc -{ - public class Program - { - public static void Main(string[] args) - { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .UseApplicationInsights() - .Build(); +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllersWithViews(); +builder.Services.AddSingleton( + new TicketService(builder.Configuration.GetConnectionString("MongoConnectionString"))); - host.Run(); - } - } +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Home/Error"); } + +app.UseStaticFiles(); +app.UseRouting(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Ticket}/{action=Index}/{id?}"); + +app.Run(); diff --git a/GR.Mvc/Properties/launchSettings.json b/GR.Mvc/Properties/launchSettings.json index 6ea3db1..f5e2c5c 100644 --- a/GR.Mvc/Properties/launchSettings.json +++ b/GR.Mvc/Properties/launchSettings.json @@ -1,27 +1,12 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:45765/", - "sslPort": 0 - } - }, +{ "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "GR.Mvc": { "commandName": "Project", "launchBrowser": true, + "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:45766" + } } } } diff --git a/GR.Mvc/Startup.cs b/GR.Mvc/Startup.cs deleted file mode 100644 index 70b8ddc..0000000 --- a/GR.Mvc/Startup.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using GR.Services; - -namespace GR.Mvc -{ - public class Startup - { - public Startup(IHostingEnvironment env) - { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - Configuration = builder.Build(); - } - - public IConfigurationRoot Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - // Add framework services. - services.AddMvc(); - services.AddSingleton(new TicketService(Configuration.GetSection("ConnectionStrings:MongoConnectionString").Value)); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) - { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - app.UseBrowserLink(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - } - - app.UseStaticFiles(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller=Ticket}/{action=Index}/{id?}"); - }); - } - } -} diff --git a/GR.Mvc/Views/Shared/_Layout.cshtml b/GR.Mvc/Views/Shared/_Layout.cshtml index 3189cca..8b82e2c 100644 --- a/GR.Mvc/Views/Shared/_Layout.cshtml +++ b/GR.Mvc/Views/Shared/_Layout.cshtml @@ -1,4 +1,3 @@ -@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet @@ -6,17 +5,16 @@ @ViewData["Title"] - GR.Mvc - + - + - @Html.Raw(JavaScriptSnippet.FullScript)